-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Multiple activeRouteHandlers #427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The best way to do this at the moment is to pass a extra handler as a prop in your routes I believe. <Routes location="history">
<Route path="/" handler={MainSection}>
<Route name="new" path="new" handler={handler} extraHandler={activeHandler2} />
</Route>
</Routes> You have to extra the second handler yourself but this works fine: var routeHandler = this.props.activeRouteHandler();
var activeRouteHanlder2 = routeHandler.props.extraHandler; |
@tcoopman Just curious. How three handlers? Besides "extraHandler", what attributes can I use? Could you please guide me to the related code base. Thanks |
Look at the sidebar example to see how the parent handler can introspect the active route handler and then branch its view logic on it: https://github.com/rackt/react-router/blob/master/examples/sidebar/app.js#L81-L84 You can mixin |
I have a mobile UI where you have a header, the "app content" thats a fixed height the size of the window with overflow auto, and then on some pages a big submit button. Sort of like this UI

The HTML is sort of like:
To achieve this design I just made
.wrapper
display:flex
in a column. That works great. The only problem is that theapp-content
is where I'm putting<this.props.activeRouteHandler/>
which means there's no clean way to to get thebig-button
to show up or hide based on the route. Is there anyway I can setup multiple<this.props.activeRouteHandler/>
so it'd look sort of like:Or, do you have other suggestions on how to handle this?
The text was updated successfully, but these errors were encountered: