Last active
October 25, 2018 02:50
-
-
Save etoxin/b79edd3d6ccf2d1c762738e47eb638c1 to your computer and use it in GitHub Desktop.
Recursive react render for dom or cms
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
RenderModal(settings) { | |
const { modalIsOpen, targetDomNode } = settings; | |
const closeModal = () => { | |
this.RenderModal( | |
Object.assign(settings, { | |
modalIsOpen: false | |
}) | |
); | |
}; | |
const ModalComponent = () => ( | |
<div> | |
<Modal isOpen={modalIsOpen}> | |
<h2>Hello</h2> | |
<button onClick={closeModal}>close</button> | |
<div>I am a modal</div> | |
</Modal> | |
</div> | |
); | |
ReactDOM.render(<ModalComponent />, targetDomNode); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment