Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mjackson
Last active August 29, 2015 14:06
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/b5141dbba5a91876a427 to your computer and use it in GitHub Desktop.
Save mjackson/b5141dbba5a91876a427 to your computer and use it in GitHub Desktop.
var User = React.createClass({
statics: {
willTransitionTo: function (transition, params, query) {
// possibly cancel the transition to a page
},
willTransitionFrom: function (transition, component) {
// possibly cancel the transition away from a page
},
didTransitionTo: function (params, query, setProps) {
// register data subscribers. call setProps as you get new data.
// works beautifully client-side
// TODO: how do we know if we need to subscribe to data or if
// we just need a one-time fetch for server rendering?
},
didTransitionFrom: function () {
// unregister data subscribers
},
shouldRenderComponent: function (props) {
// given the current set of props, return true if you've got
// everything you need to render your markup
// Maybe when the user finally returns true here we automatically
// call didTransitionFrom so they can tear everything down?
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment