Skip to content

Instantly share code, notes, and snippets.

@tokenvolt
Last active August 29, 2015 14:21
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 tokenvolt/9407c617f2bde7ae2de4 to your computer and use it in GitHub Desktop.
Save tokenvolt/9407c617f2bde7ae2de4 to your computer and use it in GitHub Desktop.
contextTypes:
router: React.PropTypes.func
tree: React.PropTypes.func
componentDidMount: ->
# TODO: set initial currentPath on page load
CurrentPathCursor = @props.tree.select('currentPath')
CurrentPathCursor.on 'update', (e) =>
if e.data.previousData != e.data.data
@context.router.transitionTo(CurrentPathCursor.get())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment