[changed] activeRoute can render with props and children.#90
[changed] activeRoute can render with props and children.#90mjackson merged 1 commit intoremix-run:masterfrom
Conversation
[changed] activeRoute can render with props and children.
|
Is it possible to get documentation on this added to the readme. |
|
FYI: as of react 0.11 you could do: |
|
Yeah, that makes this so much better without needing to do hacky things with _owner. I'll throw together a branch that does this in the readme. |
|
children can be more than one argument and are not getting passed down to the handler? |
There was a problem hiding this comment.
don't we need to route.props.handler.apply(null, [mergeProperties(props, addedProps)].concat(children)) to support this.props.activeRoute({}, child, child, child) ?
There was a problem hiding this comment.
/facepalm. Yes we do. I've discovered that we also need to return a function when activeRoute is null, or in practice you need to do {this.props.activeRoute ? this.props.activeRoute() : null} which is annoying as hell. Both fixes on the way.
There was a problem hiding this comment.
I have no idea what people will use children for. It's a little confusing IMO.
There was a problem hiding this comment.
I kind of agree, which is why I left it basically undocumented. But I think there's virtue in keeping consistent with the component API.
There was a problem hiding this comment.
If you build it, they will come.
Could use the same handler in two routes and have contextually different
children I guess?
On Fri, Jul 18, 2014 at 2:12 PM, Ben Johnson notifications@github.com
wrote:
In modules/components/Route.js:
} else { props.activeRoute = null; }
- childDescriptor = route.props.handler(props);
- childHandler = function (props, addedProps, children) {
return route.props.handler(mergeProperties(props, addedProps), children);I kind of agree, which is why I left it basically undocumented. But I
think there's virtue in keeping consistent with the component API.—
Reply to this email directly or view it on GitHub
https://github.com/rpflorence/react-nested-router/pull/90/files#r15131182
.
Potentially fixes #59.
{this.props.activeRoute}is now{this.props.activeRoute(props, children)}.