Skip to content

Instantly share code, notes, and snippets.

@ihgrant
Last active January 25, 2016 17:39
Show Gist options
  • Save ihgrant/09f0dd233c09ada9cf34 to your computer and use it in GitHub Desktop.
Save ihgrant/09f0dd233c09ada9cf34 to your computer and use it in GitHub Desktop.
react controller outside react component
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