Last active
January 25, 2016 17:39
-
-
Save ihgrant/09f0dd233c09ada9cf34 to your computer and use it in GitHub Desktop.
react controller outside react component
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
const Controller = (function () { | |
let currentRows = []; | |
const addRow = function (newRow) { | |
// add a new row to our local variable | |
render(); | |
}; | |
const render = function () { | |
ReactDOM.render(<Form onSubmit={addRow}/>, document.getElementById('myform')); | |
ReactDOM.render(<Rows rows={currentRows}/>, document.getElementById('myrows')); | |
}; | |
return { | |
render: render | |
}; | |
})(); | |
Controller.render(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment