Using React Context API in NextJS Applications

Global state in React has always been an area that has been a bit hit and miss. At the start there was the concept of passing props down the component hierarchy, and using callbacks as props to get data back up the chain. As you can imagine, this quickly got messy, and led to the development of third-party global state management tools such as Redux and MobX. It stayed this way for a number of years, until developers started to tire of the boilerplate needed for such state-management tools, and were looking for something native and easier to work with. With that, came the…