Module '"react-router-dom"' has no exported member 'RouteComponentProps'.
时间: 2024-01-10 12:01:50 浏览: 203
react-router
The error you are encountering is likely due to a mismatch between the version of `react-router-dom` you are using and the version of TypeScript you have installed.
In older versions of `react-router-dom`, the type `RouteComponentProps` was exported directly from the library. However, in newer versions, it is exported from the `react-router` package instead.
To resolve this issue, you can update your import statement to reference `react-router` instead of `react-router-dom` and import `RouteComponentProps` from there.
Here's an example of how you can update your import statement:
```typescript
import { RouteComponentProps } from 'react-router';
```
Make sure you have the latest version of `react-router` installed by running `npm install react-router`.
If you still encounter issues, please provide more details about your setup, such as the versions of `react-router-dom` and TypeScript you are using, as well as any relevant code.
阅读全文