Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript React Router 4 Basics Getting Started with React Router Installing React Router and Declaring Routes

Julieta Dalla Pozza
Julieta Dalla Pozza
4,337 Points

Get error when routing

Hello, I'm trying to follow the project, and when trying to route an error in the console appears. I checked if I have more than one react project and maybe this could be causing the problem.

THE ERROR

react.development.js:207 Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:

  1. You might have mismatching versions of React and the renderer (such as React DOM)
  2. You might be breaking the Rules of Hooks
  3. You might have more than one copy of React in the same app See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.

WHAT I GOT WHEN TRYING TO FIGURE IT OUT WHATS IS HAPPENNING ├─┬ @mui/system@5.8.0 │ │ ├─┬ @mui/private-theming@5.8.0 │ │ │ └── react@18.1.0 deduped │ │ ├─┬ @mui/styled-engine@5.8.0 │ │ │ └── react@18.1.0 deduped │ │ └── react@18.1.0 deduped │ ├─┬ @mui/utils@5.8.0 │ │ └── react@18.1.0 deduped │ ├─┬ react-dom@18.1.0 │ │ └── react@18.1.0 deduped │ ├─┬ react-transition-group@4.4.2 │ │ └── react@18.1.0 deduped │ └── react@18.1.0 deduped └─┬ react-router-dom@6.3.0 ├─┬ react-router@6.3.0 │ └── react@18.1.0 deduped └── react@18.1.0 deduped