I have a Wordpress headless CMS with a GatsbyJS Frontend where I have a React Context API boolean that is retrieved throughout all pages. When a user changes the boolean within the page and then navigates back to the previous page the boolean remains and does not revert. The boolean is stored and retrieved from local storage.
Is there any way to be able to update the context on back button click?