Created
March 10, 2016 18:07
-
-
Save AndrewRayCode/b9526e00df606e55f828 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ... | |
| render() { | |
| const { field, someCondition } = this.state; | |
| let component = null; | |
| if( someCondition ) { | |
| component = <MyChild | |
| field={ field } | |
| />; | |
| } | |
| return <div> | |
| {component} | |
| </div>; | |
| } | |
| // ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ... | |
| render() { | |
| const { field } = this.props; | |
| switch( field ) { | |
| case 'A': | |
| return <A />; | |
| case 'B': | |
| return <B />; | |
| } | |
| } | |
| // ... |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When the
fieldpassed to<MyChild />from<App />changes, then I get the error: