Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

378
Views
TypeError: (0 , _reactRouterDom.useParams) no es una función

cuando estoy usando este código para obtener la identificación de la ruta de la URL ( http://127.0.0.1:8083/#/zhuolian/activity/detail/1 ):

 import { useParams } from "react-router-dom"; handleSearchInfo = () => { const {id} = useParams(); const { dispatch } = this.props; dispatch({ type: 'activityM/getActivityDetail', payload: { pageSize: 10, pageNum: 1 ,id: id}, }); };

muestra un error como este:

 TypeError: (0 , _reactRouterDom.useParams) is not a function TableList._this.handleSearchInfo src/pages/xRepo/Activity/detail.js:166 163 | } 164 | ]; 165 | > 166 | handleSearchInfo = () => { | ^ 167 | const {id} = useParams(); 168 | 169 | const { dispatch } = this.props; View compiled TableList.componentDidMount src/pages/xRepo/Activity/detail.js:76 73 | dispatch({ 74 | type: 'activityM/clear', 75 | }); > 76 | this.handleSearchInfo(); | ^ 77 | 78 | } 79 | View compiled ▶ 16 stack frames were collapsed. (anonymous function) node_modules/dva/lib/dynamic.js:91 88 | var AsyncComponent = m.default || m; 89 | 90 | if (_this2.mounted) { > 91 | _this2.setState({ | ^ 92 | AsyncComponent: AsyncComponent 93 | }); 94 | } else { View compiled

que debo hacer para evitar este problema? la versión de mi enrutador de reacción es "react-router-dom": "^4.3.1"

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

react-router-dom agregó useParams , useLocation , useHistory y useRouteMatch en la versión v5.1.0

Acerca de cómo obtener los parámetros de URL usando react-router v4, consulte ¿Cómo obtener el valor del parámetro de la cadena de consulta?

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!