Auth0 with spa react app authenticate on load

I referred this thread How to have the login page as the default if a user is not logged in - #6 by konrad.sopala and it worked for me. Just the problem is its showing LoginButton for me on the page instead or automatically redirecting to login page if user is Nor Authenticated. I’ll appreciate any feedback.