Skip to content

Instantly share code, notes, and snippets.

@tylertreat
Created December 31, 2014 20:58
Show Gist options
  • Save tylertreat/3db4e851dc4ea2710be4 to your computer and use it in GitHub Desktop.
Save tylertreat/3db4e851dc4ea2710be4 to your computer and use it in GitHub Desktop.
var Foo = React.createClass({
render : function() {
return <div>foo</div>;
},
});
var Bar = React.createClass({
render : function() {
return <div>bar</div>;
},
});
var Router = Backbone.Router.extend({
routes : {
'foo': 'foo',
'bar': 'bar',
},
foo: function() {
this.changeView(<Foo />, document.body);
},
bar: function() {
this.changeView(<Bar />, document.body);
},
changeView: function(component, node) {
React.renderComponent(component, node);
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment