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

Add a Doc.Hydrate helper, similar to Doc.ClientSide that also renders server-side content #237

Closed
Jand42 opened this issue May 27, 2022 · 0 comments

Comments

@Jand42
Copy link
Member

Jand42 commented May 27, 2022

The Doc.ClientSide <@ MyClientSideDoc() @> function (alias client) serves to insert an empty placeholder in server-side rendering, to be filled in with client-generated content automatically.

However, for SEO and page load experience purposes, it's often nice to return some plain rendered content from the server, to be replaced with it's activated equivalent on the client.

New Doc.Hydrate helper would do this. Doc.Hydrate (MyClientOrServerSideDoc()) would auto-quote but also evaluate the argument, rendering it both on the server and then replacing it with the activated component on the client. You can use IsClient checks within your logic to make sure no JavaScript-only calls happen during the server-side execution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant