How to keep a loggedin session continued across all the pages of my react app?

I am using firebase email and password as authorization please help!!

This is my App.js. I have tried with navigate but this only works in a single page have but i want to add multiple pages for different classes and there whenever a user is logged in it will redirect me to my home page instead of redirecting to the page of i intended to go to…
I would appreciate that if you can suggest me any other method than using navigate() for home page.
I want to continue my login session across my whole app

App.js code snippet 1
App.js code snippet 2