i'm triyng to get the id from url params i'm using in react.js. This is my code
componentDidMount() {
let {id} = this.props.params
}
but i get undefined, i console loged params and i get an empty array
how can i get the param?
this is the router code
<BrowserRouter>
<Navbar />
<Switch>
<Route exact path="/" component={home} ></Route>
<Route exacth path="/details/:id" component={details} />
</Switch>
</BrowserRouter>