Skip to content
Advertisement

React Route not navigating

I have written below routes in App.js –

JavaScript

I have another component – Items which has Card (Reactstrap). Each card is having a Link –

JavaScript

Within Link tag , to attribute , I have mentioned –

JavaScript

By this I am expecting , upon clicking of card , component – ItemDetails should get rendered. But I cannot see , ItemDetails has got rendered.

Do I need to add anything else within my current code ?

Advertisement

Answer

You can use the useHistory hook which solve this problem easily

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement