© 2026 LinearBytes Inc.
Search posts, tags, users, and pages
Diego Bernal
Front-End Engineer
What if you handled that at the Route level somehow? Via a higher-order component maybe?
If you made that abstraction, you could potentially apply the HOC to any other component that might need it.
Ghanshyam K Dobariya
Software Engineer @ Twilio
Thanks Diego Bernal, this will be better approach.
You could use this article as a reference: A Complete Firebase in React Authentication Tutorial
Your logic would be different as you would be checking that a user is authenticated and current page/url is login page.