I use React Context API to store the information that a user is authenticated.
In development mode when I type in any URL that redirects to the 404 error page the con
I hope this helps you or others. The blog post below describes how you need to use gatsby-browser.js to wrap the root element in the provider so that it doesn't reset it on page change.
https://www.gatsbyjs.org/blog/2019-01-31-using-react-context-api-with-gatsby/