react-oidc-context icon indicating copy to clipboard operation
react-oidc-context copied to clipboard

Making the library compatible with React Server Components

Open mjarosie opened this issue 1 year ago • 1 comments

In Next.js in order to make the AuthProvider work on the client side with the new React Server Components feature - it needs to be wrapped in a component like this.

Would it be possible to avoid having to do this by making this library Client Component-compatible by adding 'use client' directive? As far as I understand (having a limited experience with React & Next.js) 'use client' directive isn't Next.js framework-specific, but rather soon-to-be part of the React specification, which means that this sort of modification wouldn't make react-oidc-context Next.js framework-specific.

mjarosie avatar Jun 18 '23 17:06 mjarosie

This library shall be independent of any bundler/framework. As you say the use client will be part of react. When it is officially part of react and when we bump the dependency of this library to that min. version of react we can add it. I guess this will tak some time. For the meantime you could maybe add a section in Readme.md for Next.Js...

pamapa avatar Jun 20 '23 06:06 pamapa