clerk / javascript

Official Javascript repository for Clerk authentication
https://clerk.com
MIT License
1.12k stars 246 forks source link

Bump React to v18 in clerk-js #220

Closed nikosdouvlis closed 1 year ago

nikosdouvlis commented 2 years ago

Currently, clerkjs bundles its own React dependency and uses its own React instance to render the prebuilt components, even if React is already bundled with the user's app. A required step to support true SSR for clerk-js is to make React a peer dependency, instead of a direct one.

However, that'd make clerkjs use the app's React instance, so we need to make sure that our prebuilt components work properly with the latest React release.

As part of this task, we should:

We expect that React's dev mode idempotency check might cause some of our components to break, especially those that rely on useEffects to start the auth flows (eg: calling signUp.create on render etc.). For more context, see:

Please note that this task is not about making clerkjs work inside a React18 app! We've already confirmed that it does work since clerkjs is still using its own React17 instance. The purpose of this task is to help us understand what issues we'd face if we were to drop the direct React dependency.

Making the necessary code changes is not part of this task. Let's create a detailed design doc explaining any issues and possible solutions and then discuss to figure out the next steps :)

SokratisVidros commented 1 year ago

Latest @clerk/clerk-js version (4.15.1 is using React 18. I am closing this one.