I have normal and social media login options on my page, and I have created a private Route as in <https://reacttraining.com/react-router/web/example/auth-workflow>. 
The problem is that after redirecting to for example google and back, the state of the Router history is gone.
I have created a workaround in which I store the previous URL in local storage, when the user visits the login screen.

Do you guys have any better idea on how to save History state?