1. 程式人生 > >react引入router提示,The prop `history` is marked as required in `Router`, but its value is `undefined`

react引入router提示,The prop `history` is marked as required in `Router`, but its value is `undefined`

關於react專案中,按照下述方式,在引入路由Router、Route、Link時:

import { Router, Route, Link } from 'react-router'

執行出現下述錯誤

The prop `history` is marked as required in `Router`, but its value is `undefined`. in Router

import { BrowserRouter as Router, Route } from 'react-router-dom';

安裝使用的依賴由react-router-dom替換react-router。