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!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Paige Niedringhaus
Paige Niedringhaus

Written by Paige Niedringhaus

Staff Software Engineer at Blues, previously a digital marketer. Technical writer & speaker. Co-host of Front-end Fire & LogRocket podcasts

No responses yet

Write a response