Force authentication on any page, keeps looping

I’m trying to force redirection from any site endpoint in a React SPA, but any way I try I keep getting redirect loops. I’m new to React, but I can’t find any info on how to force an entire app to login, all the examples are about creating a button to click, which presents the login screen.

I did find one example which wrapped the App component in auth checks
export default withAuthenticationRequired(withAuth0(App));
but this seems overkill and sluggish.

Does anyone have any examples of a React app where the whole app is blocked and requires login?