2

ルーターのセットアップ用に次のコードがあります。

import React from 'react'; 
import { Router, Route, browserHistory } from 'react-router'; 
import App from './App'; 

export default () => ( 
  <Router history={browserHistory}> 
    <Route name="demo" path="/mydemo" component={App} /> 
  </Router>
);

ただし、次のエラーが発生します。

Warning: Failed prop type: The prop `history` is marked as required in `Router`, but its value is `undefined`. in Router (at Router.js:12)    
Uncaught TypeError: Cannot read property 'location' of undefined at new Router (Router.js:43)
4

1 に答える 1