【问题标题】:Where can I find types for react-router-dom Location, History and Match?我在哪里可以找到 react-router-dom Location、History 和 Match 的类型?
【发布时间】:2019-10-20 16:02:26
【问题描述】:

当我使用来自react-router-dom v4.3.2 的withRouter 时,它会将三个道具传递给组件,historymatchlocation。我在哪里可以找到这三个 TypeScript 对象的类型定义?

我检查了这个链接https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-router/v3/lib,但它没有第4版。另外,那里定义的类型不包括History location and match

【问题讨论】:

标签: typescript react-router react-router-v4


【解决方案1】:
import { History, Location } from 'history';
import {match} from 'react-router';

您可以查看@types/react-router。在那里您可以看到从@types/history 定义和导入的所有类型。

【讨论】:

  • 谢谢。另外两个呢,matchlocation
猜你喜欢
  • 2020-07-11
  • 2022-12-25
  • 1970-01-01
  • 2015-02-23
  • 1970-01-01
  • 1970-01-01
  • 2019-01-24
  • 1970-01-01
  • 2010-10-30
相关资源
最近更新 更多