I'd like to access the div in the Paper implementation for animation purposes, but currently the ref method returns the Paper object, not the div (as per React's normal behaviour.)
render() {
<Paper ref={ (ref) => this.ref = ref } onTouchTap={ console.log(this.ref) } />
}
I'm proposing an extra prop (something like 'divRef'?) that can be passed down to be added to the div. Thoughts? I imagine this would be valuable across a large number of components, so I assume people will have an opinion about the neatest way to do it.
@simonhildebrandt Why not using the findDOMNode API for that use case?
However, you raised a good point. As we are using more and more stateless functional component on the next branch. That issue is going to rise.
We expose a rootRef property on the List component for an internal use case.
We could generalize this approach.
Closing this due to inactivity.
@oliviertassinari React developers intend to deprecate the findDOMNode API eventually - https://github.com/yannickcr/eslint-plugin-react/issues/678
I'd appreciate a prop to get a ref for the div too.
@alexanthony I have been removing some ref properties lately #10025. As we encourage the usage of the findDOMNode API until React find a better one #9768.
Most helpful comment
@simonhildebrandt Why not using the
findDOMNodeAPI for that use case?However, you raised a good point. As we are using more and more stateless functional component on the next branch. That issue is going to rise.
We expose a
rootRefproperty on theListcomponent for an internal use case.We could generalize this approach.