This is well written but it feels like it's half of a tutorial. The above implementation is completely unusable because the value of the context is going to be reset any time the user. I'm sorry but I'm just so frustrated. Every. Single. Tutorial about Contexts and NextJS is like this. I keep searching and searching for an example of actually using these things but all I get is articles like this one, where you're just using the context as a place to store data for a single page.
Contexts are useful because they allow components and pages to share state, right? Well then, what is the point of using one if your state is just going to be reset whenever you redirect? What is the point of having login data that disappears when you change pages? Am I missing something here? I do not understand how the above example is useful in any way if the context is just reset to the default value every time you redirect to a new page.
Edit: Yeah I was missing something. Sorry lol. I just needed to use <Link> to redirect instead of vanilla <a> tag. Maybe include that in the article for future dummies?