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

docs: using server components in islands #2416

Merged

Conversation

kiphud
Copy link
Contributor

@kiphud kiphud commented Apr 27, 2024

After reading the discussion at #2369, this PR introduces a small addition to the docs which highlights how you can use server components within islands.

This, coupled with the existing docs, should hopefully give people enough of an example to understand that islands provide the interactivity layer, and that server components within them can be hydrated and made interactive too.

Closes #2369

return (
<Card>
Counter is at {count}.{" "}
<Button onClick={() => (count.value += 1)}>+</Button>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I file like we should add a sentence that this click handler will only fire when this component is inside ./islands or referenced inside an island. I'm worried that the component name here suggests that this component would be treated as an island.

Copy link
Contributor Author

@kiphud kiphud Apr 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @marvinhagemeister

I hoped the positioning in the docs would have helped clarify that as I didn't want to be overly verbose, but I've added a sentence as you mention to make sure it's explicitly known. Let me know what you think.

Copy link
Collaborator

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet, thanks for adding this to our docs 👍

@marvinhagemeister marvinhagemeister merged commit bc75101 into denoland:main Apr 30, 2024
3 of 7 checks passed
@kiphud kiphud deleted the add-components-to-islands-docs branch April 30, 2024 18:15
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.

docs: explain better the distinction between islands and components
2 participants