在我的 React 容器/组件中,我可以使用哪种类型来引用 React Router DOM 包含的 match
部分?
interface Props {
match: any // <= What could I use here instead of any?
}
export class ProductContainer extends React.Component<Props> {
// ...
}
原文由 Nicolas Blanco 发布,翻译遵循 CC BY-SA 4.0 许可协议
您不需要显式添加它。您可以使用来自
RouteComponentProps<P>
的@types/react-router
作为道具的基本接口。P
是匹配参数的类型。