Clerk Setup with authenticated routes
I'm experiencing some issues with setting up my authenticated routes with Clerk. I see the examples with Start and the createServerFn function but I am only using react router.
In all of the examples the authentication method seems to be fully syncronous, but with Clerk and the useAuth() method, the data may not be immediately loaded. The workaround i found was to check if auth.isLoaded before proceeding with my RouterProvider. But this creates an annoying extra loading page.
then my _auth route using the auth context in beforeLoad:
Is there a more conventional method that I am just missing or is this the best solution? Thanks so much!
0 Replies