#TypeError: Cannot read properties of null (reading 'useContext')

4 messages · Page 1 of 1 (latest)

wraith sentinel
#

Sometimes I encounter this random bug where I cannot read properties of null (reading 'useContext'), even though my code doesn't even contain a useContext. In the console, I receive additional information related to usePathname. This issue only occurs on localhost and is very random.

To resolve it, I simply restart the development server, but it's becoming increasingly annoying.

clear templeBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

young tartan
#

Are you using pages router somewhere?

#

Also make sure to do null checks when using usePathname although i doubt the issue is with that and maybe something internal.

If you arent using the pages router then try downgrading and checking if the issue persists. Also consider opening a issue on GitHub