TypeScript error after upgrading version 4 useParams () from react-router-dom Property 'sumParams' does not exist on type '{}'

前端 未结 3 1001
刺人心
刺人心 2021-02-05 02:14

I get a typeScript error after upgrading to version 4 Used in useParams () from react-router-dom

"typescript": "^4.0.2"

         


        
3条回答
  •  孤城傲影
    2021-02-05 02:30

    Another option is:

    const { sumParams } = useParams() as { 
      sumParams: string;
    }
    

提交回复
热议问题