Skip to content
Advertisement

Tag: react-router

Render specific react component based on the URL

App.js Home.js This works perfectly as I want to render the Feed or Search component depending on the URL. But, I want to know is it okay to use location.pathname or is there any better alternative? Answer You could do something like: App.js Home.js This allows you to abstract away the Home component’s dependency on any routing mechanism, and simply

scroll to the top of page in reactjs

I am designing the registration page in Reactjs .and I am doing manual validation. now what I want is after clicking onSubmit, the page should scroll to the top to show all errors in the validation.I tried but failed to achieve this.is there anyone who will help me Answer If you task is to scroll to errors rather than scrolling

How to filter cars by key-value

I implement car auction, and I have a car items list inside the catalog component. I have buttons that specify the type of car (suv, bike, passenger..) when I click on any of the buttons, I want to redirect to catalog with a filtered list of cars with according typeCar. So data with objects is in App.js I have a

Advertisement