Created
November 11, 2017 13:28
-
-
Save ArunMichaelDsouza/e6671b254f2c2fccf86c27cfcbe5f73c to your computer and use it in GitHub Desktop.
React 16 portals demo
This file contains 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
class Info extends Component { | |
constructor(props) { | |
super(props); | |
} | |
render() { | |
return <Modal><Text text=“This is the text” /></Modal>; | |
} | |
} | |
class Modal extends Component { | |
constructor(props) { | |
super(props); | |
} | |
render() { | |
const node = document.getElementById(‘modal’); | |
return ReactDOM.createPortal(this.props.children, node); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment