Skip to content

Instantly share code, notes, and snippets.

@mjackson
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjackson/bfeed733d2245d52ad44 to your computer and use it in GitHub Desktop.
Save mjackson/bfeed733d2245d52ad44 to your computer and use it in GitHub Desktop.
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