0
我嘗試從https://github.com/ReactTraining/react-router/blob/master/packages/react-router-config/README.md#renderroutesroutes陣營路由器例如不工作
服務器端代碼運行例如:
router.get('/*', function(ctx, next) {
const context = {};
const initialState = {};
const appStore = createAppStore(null, initialState);
const appString = ReactDOMServer.renderToString(
<Provider store={appStore} key="provider">
<StaticRouter location={ctx.url} context={context}>
{renderRoutes(routes)}
</StaticRouter>
</Provider>
);
...
(路線 - 從例如頁面只是copypast) 一些途徑我得到請求後,始終主頁
,如果我用我自己的路線
const routes =
[
{ path: '/',
exact: true,
component: Home
},
{ path: '/about',
component: About
}
]
上兩條路線我也得到了主頁,請單擊鏈接不工作,不記錄任何錯誤
我的回購:https://github.com/kirsanv43/react-universal-starter-kit/blob/master/src/server.js