-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add support for an active class on the Link component #23
Comments
We need to decide how we would subscribe to url changes. Also I would suggest to split component onto smart and dumb one. |
var 1
var 2
var 3 |
Hm, I think we should just listen to changes on controller and check path using the option on the router. That way time travelling etc. will work as expected. Though this is starting to get very complex. A stated by @jeroenverfallie , sometimes you want the link to be active as parent of a path, but other times you do not want that. Only when it is the actual url. I think we should maybe use a function here: <Link
signal={this.props.signals.somethingHappened}
params={{foo: 'bar'}}
activeClass="active"
isActive={function (routes, route) { // matching logic}
className="my-class"
>Click me</Link> So by default it needs a perfect match, but you can decide whatever you want to make it active. Not quite sure about this. |
We thought a little. This change brings extra complexity and doesn't fit well React/Flux ideas about state driven UI. We must document such approach as best practice. |
Perhaps this ticket should be closed @Guria? |
Let it stay until it covered in docs |
closed in favor to cerebral-legacy/cerebral-module-router#82 |
When on the route, add an active class to links associated with the route.
A special case would be params.. sometimes you want the active class to show only when the params match, other times you want to only match the base.
The text was updated successfully, but these errors were encountered: