@@ -18,22 +18,22 @@ On client:
18
18
``` javascript
19
19
import React from ' react' ;
20
20
import ReactDOM from ' react-dom' ;
21
- import { Router } from ' react-router-async' ;
21
+ import { BrowserRouter } from ' react-router-async' ;
22
22
import { routes , hooks } from ' ./common' ;
23
23
import createHistory from ' history/createBrowserHistory' ;
24
24
25
25
const history = createHistory ();
26
26
const mountNode = document .getElementById (' app' );
27
27
28
- Router .init ({ path: history .location .pathname , routes, hooks, history }).then (({ Router, routerProps, Component, componentProps, callback }) => {
28
+ BrowserRouter .init ({ path: history .location .pathname , routes, hooks, history }).then (({ Router, routerProps, Component, componentProps, callback }) => {
29
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 (({ Router, routerProps, status, redirect }) => {
36
+ ServerRouter .init ({ path: req .path , routes, hooks }).then (({ Router, routerProps, status, redirect }) => {
37
37
if (redirect) {
38
38
res .redirect (status, redirect);
39
39
} else {
0 commit comments