How to catch the dynamic part of the URL in react router

I have this route which calls PriceWithId function

<Route path='/collections/:pId' component={PriceWithID} />

The function is like this

const PriceWithID = ({match}) =>
        let test = Object.entries(match);
        let test2 = test.filter(([prop])=>(prop === 'params'));
        let test3 = test2[0][1];
        let test4 = Object.values(test3)[0]
          <Price image={IMGS.filter((i)=>( === parseInt(test4,10)))[0]}/>

I know there is a nicer oneline way to achieve test4. The method I used came with trial and error. Can anyone tell me the nicer way so that I can replace test4 in parseInt with it

Source: React Router Questions