{user.name[0]} described as a null value
in the footer section when i compile and run there is an error in the terminal under the name for {user.name[0]} and says cannot read properties of null 'name' even though the file doesn't seem to be screaming over any errors. Eventually the if statement loggedOut for router.push; export const Footer = ({ user, type = 'desktop' }: FooterProps) => { const router = useRouter(); const handleLogOut = async () => { const loggedOut = await logoutAccount();
if(loggedOut) router.push('/sign-in')
} the loggedOut is flaring and says an expression of type void cannot be tested for truthiness(if that's even a correct statement).
when you go to home page directly without sign in or sign up it will through a null value. To go to the logged in user you have to sign in by going. http://localhost:3000/sign-in. http://localhost:3000/sign-up. Then log in using the email and password. then you will be directed to your dashboard. start working from there. also in the layout.tsx root component. const loggedIn = await getLoggedInUser(); if (!loggedIn) redirect("/sign-in");
and watch the video completely
OMG ! THANK YOU ShadowRoot-ops.I had the same issue with user.name[0] being null in the RightSidebar.tsx. Could not understand what is wrong with syntax for 3 days. First ,I thought there was some issue with index.d.ts but all you need to do is actually create new "user" by first sign-up and then sign-in