记一次Typescript+react的match的坑

 1 import React from "react";
 2 import { match } from 'react-router-dom'
 3 
 4 interface Props {
 5     match: match<{id?: string}>
 6 }
 7 
 8 const Rdx: React.FC<Props> = ({ match }: Props) => {
 9     const id = match.params.id;
10     return (
11         <div>
12             我是Rdx页面,id是 {id}
13         </div>
14     );
15 }
16 export default Rdx

猜你喜欢

转载自www.cnblogs.com/ywenhao/p/12217334.html
今日推荐