Thanks!
One solution I can think of is to have a state boolean that you change the state of at the same time you clear local storage.
That boolean could then be included in a useEffect's dependency array and anytime it changes, it could check the boolean value and fire off a logout function when needed.
I hope this might help!