@@ -25,20 +25,20 @@ import createHistory from 'history/createBrowserHistory';
25
25
const history = createHistory ();
26
26
const mountNode = document .getElementById (' app' );
27
27
28
- Router .init ({ path: history .location .pathname , routes, hooks }).then (({ Router, Component, router , callback }) => {
29
- ReactDOM .render (< Router {... { Component, router, history } } / > , mountNode, callback);
28
+ Router .init ({ path: history .location .pathname , routes, hooks, history }).then (({ Router, routerProps, Component, componentProps , callback }) => {
29
+ ReactDOM .render (< Router {... routerProps } / > , mountNode, callback);
30
30
}).catch (error => console .log (error));
31
31
```
32
32
33
33
On server (for example as express middleware):
34
34
``` javascript
35
35
export default function (req , res , next ) {
36
- Router .init ({ path: req .path , routes, hooks }).then (({ Component , status, redirect }) => {
36
+ Router .init ({ path: req .path , routes, hooks }).then (({ Router, routerProps , status, redirect }) => {
37
37
if (redirect) {
38
38
res .redirect (status, redirect);
39
39
} else {
40
40
const html = ReactDOM .renderToStaticMarkup (HtmlComponent ({
41
- markup: ReactDOM .renderToString (< Component / > ),
41
+ markup: ReactDOM .renderToString (< Router { ... routerProps} / > ),
42
42
assets: assets
43
43
}));
44
44
res .status (status).send (' <!DOCTYPE html>' + html);
0 commit comments