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]
return(
<Price image={IMGS.filter((i)=>(i.id === 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