が、これは
// From the react-router docs: "If `callback` is listed as a 3rd argument,
// this hook will run asynchronously, and the transition will block
// until `callback` is called."
const reloadPage = (nextState, replace, callback) => {
window.location.reload();
};
const routes = (
<Route path="/" component={Chrome}>
<IndexRoute component={Home}/>
<Route path="catagory" component={CategoryPage}/>
<Route path="*" onEnter={reloadPage}/>
</Route>
);
ReactDOM.render((
<Router history={browserHistory}>{routes}</Router>
),
rootEl
);
なり...
react-router
v3の
const reloadPage = (nextState, replace, callback) => {
callback("Route not found");
window.location.reload();
};
const routes = (
<Route path="/" component={Chrome}>
<IndexRoute component={Home}/>
<Route path="catagory" component={CategoryPage}/>
<Route path="*" onEnter={reloadPage}/>
</Route>
);
try {
ReactDOM.render((
<Router history={browserHistory}>{routes}</Router>
),
rootEl
);
} catch (err) {
if (err !== "Route not found") {
throw err;
}
}
をそれを考え出しました