Skip to content

Commit 3db323c

Browse files
committed
document route props passing to route handlers
closes #155
1 parent 760f021 commit 3db323c

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

docs/api/components/Route.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,35 @@ handler will have the child route's handler available as
3030
`this.props.activeRouteHandler`. You can then render it in the parent
3131
passing in any additional props as needed.
3232

33+
### [prop]
34+
35+
Any additional, user-defined, properties will be become properties of
36+
the rendered handler.
37+
38+
#### Example:
39+
40+
```js
41+
var App;
42+
var foo = "hello";
43+
44+
var routes = (
45+
<Routes>
46+
// pass `foo` to `something`
47+
<Route handler={App} something={foo}/>
48+
</Routes>
49+
);
50+
51+
App = React.createClass({
52+
render: function() {
53+
// access `something` on props
54+
return <div>{this.props.something}</div>
55+
}
56+
});
57+
58+
React.renderComponent(routes, document.body);
59+
document.body.innerHTML // -> <div>hello</div>
60+
```
61+
3362
Example
3463
-------
3564

0 commit comments

Comments
 (0)