get parameter value from url using React Router get parameter value from url using React Router reactjs reactjs

get parameter value from url using React Router


In case of anyone having this problem.The correct would be:

const userId = this.props.match.params.id;

05/2020 UPDATE USING REACT ROUTER V4 AND HOOKS

import { useParams } from 'react-router-dom';//Then inside your componentconst { id } = useParams();


You can try this

const id = this.props.computedMatch.params.id