-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[core] Remove some rootRef properties #9676
[core] Remove some rootRef properties #9676
Conversation
@cherniavskii What's your use case? Have you tried |
@oliviertassinari yes, but |
@cherniavskii I'm very tempted to refuse this pull-request and to remove the |
This facebook/react#11401 (comment)! It would even make sense to expose such API on our side. |
@cherniavskii Ok, react-bootstrap maintainers have the same position on the topic facebook/react#11401 (comment). Let's remove those two refs props. The less we have them, the better we anticipate the future. The ref property might just get away. |
2a1d1a1
to
1f5b2da
Compare
@cherniavskii Thank you for raising the concern! |
@oliviertassinari so solution is to use |
@cherniavskii Yes, and you can abstract it away with: class RootNodeWrapper extends React.Component {
componentDidMount() {
this.props.rootRef(ReactDOM.findDOMNode(this))
}
componentWillUnmount() {
this.props.rootRef(null)
}
render() {
return <this.props.children />
}
}
// usage
<RootNodeWrapper rootRef={...}><SomeChildComponent /></RootNodeWrapper> If you prefer. |
@oliviertassinari Thanks! |
@oliviertassinari Might be worth documenting... |
@mbrookes This is idiomatic React. What do you want to document? |
Just thinking for users who have been depending on the rootRef prop, it could be a useful reminder. Perhaps in the release notes? |
@mbrookes Yes, the "Breaking changes" section of this pull request description will end up in the release notes 👍 . |
Currently there is no way to get
Typography
node ref.Passing
ref
toTypography
returns component instance, returned bywithStyles
.There is
findDOMNode
, but it's not recommended.Breaking changes
rootRef
property from theGrow
andList
component.Instead, you can use the
ref
property in combinaison withfindDOMNode()
.