我有一些代码:
export default function universalRouter(location, history, store) {
return new Promise((resolve, reject) => {
Router.run(routes, location, [createTransitionHook(store)], (error, initialState, transition) => {
const component = (<Provider store={store}
key = 'provider' > {() => < Router{...initialState}
children = {routes}/>} < /Provider>);
return resolve({
component,
isRedirect: false
});
});
});
}
和一些路线:
<Route>
...
<Route path='*' component={NotFound}/>
</Route>
如何检入此代码组件解析NotFound,也许是instanceof Notfound,react-router v1.0.0的版本
答案 0 :(得分:0)
export default function universalRouter(location, history, store) {
return new Promise((resolve, reject) => {
Router.run(routes, location, [createTransitionHook(store)], (error, initialState, transition) => {
const component = (<Provider store={store}
key = 'provider' > {() => < Router{...initialState}
children = {routes}/>} < /Provider>);
return resolve({
component,
isRedirect: true
});
});
});
}