There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
You can also find further discussion and get answers to your questions over in Language Help.
Agree with a comment or answer? Like () to up-vote the contribution!
My issue has been that after applying the code in task 1 of Exercise 4 of Learn React Router v6 , the app didn’t render in the browser, it stayed completely blank, while it should be displaying the header and the footer, or in other words, it should be rendering the component.
The DevTools console was showing a few errors, including:
Uncaught TypeError: Cannot read properties of null (reading 'useState')
at Object.useState (react.development.js:1622:1)
at RouterProvider (index.tsx:493:1)
at renderWithHooks (react-dom.development.js:16305:1)
at mountIndeterminateComponent (react-dom.development.js:20074:1)
at beginWork (react-dom.development.js:21587:1)
at HTMLUnknownElement.callCallback (react-dom.development.js:4164:1)
at Object.invokeGuardedCallbackDev (react-dom.development.js:4213:1)
at invokeGuardedCallback (react-dom.development.js:4277:1)
at beginWork$1 (react-dom.development.js:27451:1)
at performUnitOfWork (react-dom.development.js:26557:1)
and:
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.
I’m not sure how I’ve managed to solved it but the steps I’ve taken are:
1 - Download zip
2 - Extract zip
3 - Open the folder that contains the packaje.json
4 - Run a terminal in this folder thtough right click > open in terminal
5 - Run npm install
6 - Run npm audit fix
7 - Run npm install @reduxjs/toolkit@latest
8 - Run npm install react-redux@latest
9 - Run npm install react-router-dom@6
10 - Open the folder that contains the packaje.json through the VS code editor.
11 - Modify the App.js file to match the code in the lesson
12 - Run npm start in the terminal
Then a browser page has opened correcty rendering it