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

85
Views
Typecheck params.id using PropTypes in ReactJS

In ReactJS, you can access the ID passed to a route with {this.props.params.id}. However, how do you use PropTypes to typecheck the params.id property? The below doesn't work and throws an error.

Person.propTypes = {
  params.id: React.PropTypes.string
};
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Use React.PropTypes.shape to verify an object's properties -- https://facebook.github.io/react/docs/typechecking-with-proptypes.html

Something like this should work:

Person.propTypes = {
  params: React.PropTypes.shape({
    id: React.PropTypes.string
  })
};
over 4 years ago · Santiago Trujillo 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!