-
Notifications
You must be signed in to change notification settings - Fork 83
Description
This is with the React 0.12 branch of RRC. I haven't tried it with the current release of RRC.
I want to pass props down to a page view, but I can't seem to pass them further than the <Pages />
component; if I console.log
a handler's props, I just get whatever default props were defined on it, not props passed down. FWIW the route parameters are passed down correctly.
I think I could use a React factory to wrap my handlers and pass props in that way, but I'd very much like to keep the nice clean syntax as seen below. Is this a bug in RRC, or is it simply not supported?
I have a <Router />
with routes in it:
var Router = React.createClass({
render: function() {
return (
<Pages {...this.props}>
<Page path="/dashboard" handler={Dashboard} />
<Page path="/auth" handler={Auth} />
<Page path="/user" handler={User} />
<NotFound handler={Home} />
</Pages>
)
}
})
And an <App />
which contains my app:
var App = React.createClass({
render: function() {
return (
<html>
<head>
<link rel="stylesheet" href="/public/css/style.css" />
</head>
<Router {...this.props} />
</html>
)
}
})
I'm using the React 0.12 spread operator {...this.props}
to pass down all the props to the router (using the 0.12 branch of RRC). This by itself works fine.