Relative Content

Tag Archive for reactjsreact-router-dom

How can you conditionally render components on a page and use routing together?

I took a previously working page that conditionally rendered components and tried to add routing via react-routerv6. It’s neither updating the URI nor the page when I try to change the selectedComponent via the webpage. I’m not getting an error in the console during build or chrome console. Is the problem that I’m trying to use routing on a component within App.js?

div not rendering react-router-dom

I’m trying to add a react component to a webpage following this documentation: https://react.dev/learn/add-react-to-an-existing-project

Mixing useNavigate with useHistory in React

In my current workplace, the project that I am supposed to work on has used useHistory up to now. I know that in newer versions it is usually better to use useNavigate. Would it be okay (non-breaking) to start using useNavigate inside of my new components without changing the older components to use useNavigate.