I have a NextJS application with a page to display some information from my API. I currently have a useEfect hook with an empty dependency list that calls the API. The problem is that if a user then goes to another page and changes their information, when they navigate back to the first page the useEffect hook doesn't run again and the user is shown outdated information.
I know that this is somehow related to the fact that NextJS doesn't refresh page states with navigation, but I'm unsure how to get around it. I've tried using the NextJS useRouter hook and adding router.query.slug to the useEffect dependency list but that doesn't seem to do anything.
Any help is appreciated, thanks!
useEffect(() => {
loadInformation();
}, []);
This doesn't fire when I navigate back to the page but I would like it to.