Home > other >  UseParams() not working and not rendering data on screen
UseParams() not working and not rendering data on screen

Time:02-17

I am working on an eCommerce website and I am stuck . I am mapping through a array and it renders Image and a link . I want to click the link(checkitem) on image and it should open the Image and detail in different page but its not working. I am using reactrouter for it and passing the id of the image to useparams() in my Fullcard component . In my Full card component i am filtering and mapping the array according to the id of the image , but it seems to not work .Can you guys help me.

Here is the CodeSandboxLink of the project : Edit useparams-not-working-and-not-rendering-data-on-screen

CodePudding user response:

useParams() is working fine. As id in FullCard is of type string so you are comparing type and value both in FullCard filter. So please use items.id==id or items.id===Number(id).

  • Related