Skip to content

Instantly share code, notes, and snippets.

@AndrewRayCode
Created March 10, 2016 18:07
Show Gist options
  • Select an option

  • Save AndrewRayCode/b9526e00df606e55f828 to your computer and use it in GitHub Desktop.

Select an option

Save AndrewRayCode/b9526e00df606e55f828 to your computer and use it in GitHub Desktop.
// ...
render() {
const { field, someCondition } = this.state;
let component = null;
if( someCondition ) {
component = <MyChild
field={ field }
/>;
}
return <div>
{component}
</div>;
}
// ...
// ...
render() {
const { field } = this.props;
switch( field ) {
case 'A':
return <A />;
case 'B':
return <B />;
}
}
// ...
@AndrewRayCode

Copy link
Copy Markdown
Author

When the field passed to <MyChild /> from <App /> changes, then I get the error:

Warning: React can't find the root component node for data-reactid value .0.1.7. If you're seeing this message, it probably means that you've loaded two copies of React on the page. At this time, only a single copy of React can be loaded at a time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment