Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save thekevinscott/d0fb8e289cf2769141980f69b6ad7cfb to your computer and use it in GitHub Desktop.
Save thekevinscott/d0fb8e289cf2769141980f69b6ad7cfb to your computer and use it in GitHub Desktop.
class WrapperComponent extends Component {
constructor(props) {
super(props);
this.refHandler = this.refHandler.bind(this);
}
refHandler(c) {
this.instance = c.getWrappedInstance();
}
render() {
return (
<WrappedComponent
{...this.props}
ref={this.refHandler}
/>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment