Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(@kadena/react-ui): Updating client components #799

Merged
merged 2 commits into from
Aug 22, 2023

Conversation

eileenmguo
Copy link
Contributor

This adds "use client" to the top of all client components.

Looked into a couple options:

  • export client components via a separate export - this adds more complexity for users and it doesn't offer much except clear separation between server and client components
  • exporting all components via the default export and also exporting only the server components via a rsc export. This is how some other packages are handling this, but I don't think the benefits are applicable in our component library

The approach chosen is to export all components together. This works becuase:

  • Server components and client components can be used in server components
  • Server components can't be used within client components, but if the consuming component is a client component it should define "use client" at the top which would effectively cause any imported server components to be treated as client components. Although it is stated that we server components should not be used in client components, it works in this case since the ui components don't have any server only logic

@vercel
Copy link

vercel bot commented Aug 18, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 22, 2023 8:55am
3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
alpha-docs ⬜️ Ignored (Inspect) Visit Preview Aug 22, 2023 8:55am
immutable-records ⬜️ Ignored (Inspect) Visit Preview Aug 22, 2023 8:55am
tools ⬜️ Ignored (Inspect) Visit Preview Aug 22, 2023 8:55am

@eileenmguo eileenmguo merged commit 0fe796a into main Aug 22, 2023
4 checks passed
@eileenmguo eileenmguo deleted the fix/client-components branch August 22, 2023 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants