@@ -25,20 +25,20 @@ import createHistory from 'history/createBrowserHistory';
2525const history = createHistory ();
2626const mountNode = document .getElementById (' app' );
2727
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);
3030}).catch (error => console .log (error));
3131```
3232
3333On server (for example as express middleware):
3434``` javascript
3535export 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 }) => {
3737 if (redirect) {
3838 res .redirect (status, redirect);
3939 } else {
4040 const html = ReactDOM .renderToStaticMarkup (HtmlComponent ({
41- markup: ReactDOM .renderToString (< Component / > ),
41+ markup: ReactDOM .renderToString (< Router { ... routerProps} / > ),
4242 assets: assets
4343 }));
4444 res .status (status).send (' <!DOCTYPE html>' + html);
0 commit comments