Skip to content
Discussion options

You must be logged in to vote

For now I've solved it like this:

import { Router, RouterProvider } from '@tanstack/react-router';
import { createRoot } from 'react-dom/client';
import { ClerkProvider, useAuth } from '@clerk/clerk-react';
import { routeTree } from './routeTree.gen';

const router = new Router({
  routeTree,
  context: {
    auth: undefined,
  },
});

const app = document.getElementById('root') as any;

const Root = () => {
  const auth = useAuth();

  return (
    <>
      <RouterProvider router={router} context={{ auth }} />
    </>
  );
};

createRoot(app).render(
  <ClerkProvider publishableKey={process.env.VITE_CLERK_PUBLISHABLE_KEY}>
    <Root />
  </ClerkProvider>,
);

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sandervspl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant