Last active
August 29, 2015 14:06
-
-
Save mjackson/b5141dbba5a91876a427 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 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