-
Notifications
You must be signed in to change notification settings - Fork 109
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
Removed findDOMNode call and use refs #41
Removed findDOMNode call and use refs #41
Conversation
9eec4dc
to
924101b
Compare
@fcsonline sorry just saw this, I'd like to not add an additional wrapping div. It seems like using refs is the only way to get testing to work with this component though 😕. Maybe we can allow people to pass the component they want measured as a prop? So it would be something like |
But then we are changing the api for this component... Could we add a component wrapper and pass them as you say? Like this:
render() {
return (
<MeasureWrapper ref={(c) => { this._node = c; }}>
{ filtered }
</MeasureWrapper>
);
} or render() {
return (
<MeasureWrapper
ref={(c) => { this._node = c; }}
component={this.props.component}
/>
);
} |
Been thinking about this more and this would be a breaking change, or maybe just an addition, but what about a HoC called |
Just did some poking around and came across this and looked at the eslint-react thread that was posted there as well. So it seems like the only path forward would be to use |
I think I finally landed on a solution! So this would be using a HoC, but I think we can apply it to React Measure as well.
so the biggest difference is just requiring the user to pass the usage for the HoC looks like this:
I'll try and take a stab at it for React Measure ASAP. Feel free to take a pass at it if you would like to. |
Finally landed on something 😅 thanks for your initial work! It inspired the latest release 😄 |
More information here: #35