[Feature Request]: Add "use client" directive to components that need it when rendered under RSC #3346
Open
2 tasks done
Labels
enhancement
New feature or request
Description
I'd like to revive the discussion from #1106.
When that issue was created, React Server Components were an experimental technology. Today the situation is different. The official React docs on the "use client" directive states, under the heading "Using third-party libraries":
Indeed, the Cloudscape docs seem to acknowledge the need for the
'use client'
directive when consuming Cloudscape components, as you see in the App layout example.I've spun up a CodeSandbox to demonstrate the issue: https://codesandbox.io/p/devbox/ckktyz I've created a new Next.js 14 app (not Next.js 15 because Cloudscape doesn't support React 19 yet) and dropped in the App layout example. It works fine (after adding a fix for the hydration error), but if you remove
"use client"
you'll get an error from trying to render theI18nProvider
:It would be significantly more convenient for folks using Cloudscape with Next.js or other frameworks that support React Server Components if
I18nProvider
(and all other Cloudscape components that can't run as server components) had the"use client"
directive themselves, allowing them to be used directly from server components. That way, devs could take full advantage of RSC without having to add an extra wrapper component between their page and Cloudscape:The project eslint-plugin-react-server-components might be helpful for automating the task of adding
"use client"
to components that need it.Code of Conduct
The text was updated successfully, but these errors were encountered: