-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Meta attributes inside Route? #927
Comments
Using a (global, immutable) name-props mapping is probably what I would do. If you don't plan on using handlers for multiple routes, you could also consider putting those props on the handler statics and then do There's another discussion about this in #615. |
+1 |
I made a PR: #1002 |
You can put that meta data on your handlers: <Route name="profiles" path="/profiles" handler={Profiles} />
class Profiles extends React.Component {
render () {
var { icon } = this.constructor.breadcrumbs;
}
}
Profiles.breadcrumbs = {
breadcrumbName: 'Company Directory',
icon: 'phonebook'
}; |
oh, sorry @taurose I jumped straight to the comment box and missed yours! |
Most HOC builders entirely block access to original component, therefore to her static props. |
I'm building breadcrumbs for my application and I think it would be really helpful for a Route to have a sort of
meta
property, where you could give it whatever attributes you want.For example:
Then you could just iterate over
this.getRoutes()
and do whatever you need to do. I think it would be much more convinent for simple cases then maintaining a seperatestore
that has mappings for each route byname
. Or is using astore
with a mapping to the route names preferred?#492 @irvinebroque
The text was updated successfully, but these errors were encountered: