Closed
Description
I have a route that I would like to always do a redirect to a deeper url. My attempt to do so is as follows: (Example is in cjsx, a coffeescript variation of jsx)
Redirect = React.createClass
displayName: 'Redirect'
statics:
willTransitionTo: (transition) ->
transition.redirect(@props.redirect)
render: (->)
# TODO: When react-router updates utilize Routes.initialPath
# For details see: https://github.com/rackt/react-router/issues/111
React.renderComponent(
<Routes location='history'>
<Route handler={Guide}>
<Route name='style-guide' path='/style-guide' handler={Redirect} redirect='/style-guide/components' />
<Route name='components' path='/style-guide/components' handler={StyleGuideComponent} />
<Route name='icons' path='/style-guide/icons' handler={IconsComponent} />
</Route>
</Routes>,
document.body
)
The problem is that you will ever be able to access the props in willTransitionTo
since it's static. Do y'all have any suggestions?
Metadata
Metadata
Assignees
Labels
No labels