Last active
August 29, 2015 14:07
-
-
Save mjackson/bfeed733d2245d52ad44 to your computer and use it in GitHub Desktop.
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
var App = React.createClass({ | |
statics: { | |
getRouteProps: function (params, query) { | |
return { | |
currentUser: getCurrentUser() | |
}; | |
} | |
}, | |
render: function () { | |
return <this.activeRouteHandler/>; | |
} | |
}); | |
var Profile = React.createClass({ | |
statics: { | |
getRouteProps: function (params, query) { | |
return { | |
profileUser: getUser(params.userID) | |
}; | |
} | |
}, | |
render: function () { | |
var profileUser = this.props.profileUser; | |
if (profileUser == null) | |
return null; | |
return ( | |
<div>Hi {profileUser.name}</div> | |
); | |
} | |
}); | |
var routes = ( | |
<Routes> | |
<Route handler={App}> | |
<Route name="profile" path="/users/:userID" handler={Profile}/> | |
</Route> | |
</Routes> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment