# Warning Issues with React-Router-Dom?

**URL:** <https://forum.codewithmosh.com/t/warning-issues-with-react-router-dom/17365>\
**Category:** React\
**Created:** [December 31, 2022, 9:11pm UTC](https://forum.codewithmosh.com/t/warning-issues-with-react-router-dom/17365 "2022-12-31T21:11:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DinoBot87](https://avatars.discourse-cdn.com/v4/letter/d/34f0e0/32.png) [@DinoBot87](https://forum.codewithmosh.com/u/DinoBot87)\
**Post date:** [December 31, 2022, 9:11pm UTC](https://forum.codewithmosh.com/t/warning-issues-with-react-router-dom/17365/1 "2022-12-31T21:11:26Z")

</div>

Hi everyone,

Wanted to ask if anyone following the Mastering React course ran into these warnings and errors regarding route registration. I just completed the Registration Form section of the course and went to go register the new route, and realized I was getting these warnings. Knowing that this is an old course, I followed the warning suggestion and ran `npx react-codemod rename-unsafe-lifecycles` on my root project directory. Still didn’t resolve issue, and now notice that my invalid URL path redirects are also not working. Upon entering an invalid route, I get the below issues.

Wondering if these issues are related…?

Any insight would be appreciated, thanks!

 ![Screen Shot 2022-12-31 at 1.57.17 PM](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/a/ad9bb7f6b3c87e1f3928c0dae017e8d272bf9a24.png)  
 ![Screen Shot 2022-12-31 at 2.03.03 PM](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/9/970103063842cf86893b7f387d462965de45d3c6.png)  
 ![Screen Shot 2022-12-31 at 2.09.06 PM](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/8/87c7688b7ead2253662e3b90173b3f5e95128a91.png)

---

<div class="post-metadata">

**Author:** ![maverick](https://avatars.discourse-cdn.com/v4/letter/m/258eb7/32.png) [@maverick](https://forum.codewithmosh.com/u/maverick)\
**Post date:** [January 1, 2023, 4:25am UTC](https://forum.codewithmosh.com/t/warning-issues-with-react-router-dom/17365/2 "2023-01-01T04:25:32Z")

</div>

A lot of libraries has changed and it will be hard to fix if you keep using older versions.

You need to update the libraries and use the latest versions.

If you get stuck, create a new ticket here and post your code, I am sure we can assist you.

---

<div class="post-metadata">

**Author:** ![DinoBot87](https://avatars.discourse-cdn.com/v4/letter/d/34f0e0/32.png) [@DinoBot87](https://forum.codewithmosh.com/u/DinoBot87)\
**Post date:** [January 1, 2023, 5:51pm UTC](https://forum.codewithmosh.com/t/warning-issues-with-react-router-dom/17365/3 "2023-01-01T17:51:41Z")

</div>

Thanks for your response, I was able to fix the issue. For anyone in the future that runs into outdated package versions, try the steps below

**Package Update Resolution Steps:**

1. Install npm check updates `npm install -g npm-check-updates`
2. Run `npm outdated` to verify outdated package versions
3. In my case, need to update react-router-dom to 6.6.1, so I ran `ncu --upgrade react-router-dom`
4. Verify the correct package update and then run `npm install`

**For react-router-dom 6.6.1**

1. `Switch` has been deprecated for route switching, switch to `Routes` instead
2. `components` in route registration must be registered as `element` attributes `element={<LoginForm/>}` for example
3. `Navigate` must be imported and used for redirects (e.g., `<Route path="*" element={<Navigate to="not-found" />} />`)

Hope this helps someone in case they’re stuck in the future.
