【发布时间】:2022-01-08 19:05:41
【问题描述】:
我正在使用 v5 的 react-router-dom。
npm ls --depth=0 | grep 'react-router-dom'
├── @types/react-router-dom@5.3.2
├── react-router-dom@5.3.0
但是,我收到一个错误,例如类型定义引用 v6。
Type '{ exact: true; path: string; component: FC<{}>; }' is not assignable to type 'IntrinsicAttributes & (PathRouteProps | LayoutRouteProps | IndexRouteProps)'.
Property 'exact' does not exist on type 'IntrinsicAttributes & (PathRouteProps | LayoutRouteProps | IndexRouteProps)'. TS2322
93 | </Header>
94 | <ContentBody>
> 95 | <Route exact path="/" component={TopPage} />
| ^
96 | </ContentBody>
97 | </Content>
98 | </Container>
我想知道如何在不更新到 v6 的情况下避免这种情况。
【问题讨论】:
标签: reactjs react-router react-router-dom