Skip to content

Commit b650ff1

Browse files
committed
Document setRoutingState
1 parent acd758c commit b650ff1

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Diff for: docs/recipes/custom-router.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,19 @@ We are going to implement custom router as a mixin:
1919
var Router = require('react-router-component')
2020

2121
var MyRouterMixin = {
22-
mixins: [Router.RouterMixin, Router.AsyncRouteRenderingMixin],
22+
mixins: [Router.RouterMixin, Router.RouteRenderingMixin],
2323

2424
getRoutes: function(props) {
2525
var routes = []
2626
for (var path in this.routes)
2727
routes.push({path: path, handler: this.routes[path]})
2828
return routes
29+
},
30+
31+
setRoutingState: function(state) {
32+
// contains match, matchProps, handler, prefix, navigation;
33+
// see RouterMixin
34+
this.setState(state);
2935
}
3036
}
3137

@@ -38,7 +44,9 @@ the environment router works in).
3844
This mixin expects that you would implement `getRoutes` method which should
3945
return a list of route descriptions in form of `{path: ..., handler: ...}`.
4046

41-
Second, `Router.AsyncRouteRenderingMixin` is a strategy which specifies how
47+
`RouterMixin` also supports intercepting its use of `setState` via `setRoutingState`.
48+
49+
Second, `Router.RouteRenderingMixin` is a strategy which specifies how
4250
handler is rendered. It provides a method `renderRouteHandler()`.
4351

4452
We can now define our custom routers like this:

0 commit comments

Comments
 (0)