Skip to content

Instantly share code, notes, and snippets.

@iammerrick
Created August 18, 2016 22:02
Show Gist options
  • Save iammerrick/8e0284b667d69bf47610287a98144285 to your computer and use it in GitHub Desktop.
Save iammerrick/8e0284b667d69bf47610287a98144285 to your computer and use it in GitHub Desktop.
class MyWrapper extends React.Component {
componentDidMount() {
this.setState({
instance: new WhateverIAmWrapping(this.node)
});
}
render() {
return (
<div ref={(ref) => this.node } />
{this.state.instance ? (
<div>
<HandleWhateverForInstance instance={this.state.instance} />
<HandleSomethingElseForInstance instance={this.state.instance} />
</div>
) : null}
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment