Click here to Skip to main content
15,849,785 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I need a Welcome.jsx page with Login, Register, and Dasboard. Breeze does it. But I want to load components to Welcome.jsx {children} with the Navlinks (the Myfirst.jsx and Mysecond.jsx components). The loading is working when the #authentication div is commented out. But when it is not commented I have errors like this:

Uncaught TypeError: Cannot read properties of undefined (reading 'user') at Welcome (Welcome.jsx:9:27) at renderWithHooks (react-dom.development.js:16305:18) at mountIndeterminateComponent (react-dom.development.js:20074:13) at beginWork (react-dom.development.js:21587:16) at HTMLUnknownElement.callCallback2 (react-dom.development.js:4164:14) at Object.invokeGuardedCallbackDev (react-dom.development.js:4213:16) at invokeGuardedCallback (react-dom.development.js:4277:31) at beginWork$1 (react-dom.development.js:27451:7) at performUnitOfWork (react-dom.development.js:26557:12) at workLoopSync (react-dom.development.js:26466:5)

What I have tried:

Here is the GitHub repository(You need the Cannot_Read_User branch):

GitHub - folza1/chirper-react at Cannot_Read_User[^]
Posted
Updated 21-Jun-23 3:21am
Comments
Richard MacCutchan 21-Jun-23 8:24am    
"Cannot read properties of undefined (reading 'user') "
This message tells you that you are using an uninitialised reference in your code. So go to the line mentioned in the error message to see what you are missing.
folza 21-Jun-23 8:36am    
But when I use it without NavLink-s and {children} it works.
Richard MacCutchan 21-Jun-23 9:14am    
Fine, but you still need to look at the code and/or use the debugger to find the root cause(s) of the problem. You will not find it by guesswork.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900