Skip to content

Instantly share code, notes, and snippets.

@pragmaticlogic
Last active August 29, 2015 14:21
Show Gist options
  • Save pragmaticlogic/002747bdfe3e36b748ee to your computer and use it in GitHub Desktop.
Save pragmaticlogic/002747bdfe3e36b748ee to your computer and use it in GitHub Desktop.
var Route = React.createClass({
mixins: [RouterMixin],
routes: {
'/': 'home'
,'notfound/:userName': 'notfound'
,'dashboard/:userName': 'dashboard'
,'repos/:userName': 'repos'
},
render: function() {
return this.renderCurrentRoute()
},
home: function(userName) {
return <Main data = { null } />
},
notfound: function(userName) {
return <Main data = { userName }/>
},
dashboard: function(userName) {
return <Dashboard data = { userName }/>
},
repos: function(userName) {
return <Repos data = { userName }/>
},
notFound: function(path) {
return <div class="not-found">Page is not found: {path}</div>;
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment