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

Provide a way to pass context to renderToStaticMarkup on the client #14292

Closed
gaearon opened this issue Nov 20, 2018 · 3 comments
Closed

Provide a way to pass context to renderToStaticMarkup on the client #14292

gaearon opened this issue Nov 20, 2018 · 3 comments
Labels

Comments

@gaearon
Copy link
Collaborator

gaearon commented Nov 20, 2018

See #14287 (comment) and #14182 (comment). This accidentally worked for a few releases but was a bug. However we might want to consider actually supporting this with an opt-in API.

@gaearon
Copy link
Collaborator Author

gaearon commented Mar 29, 2022

Generally, using SSR methods on the client is discouraged. Instead, it's better to render into a DOM node and then read innerHTML from it, for example. This also solves the context issue.

@gaearon gaearon closed this as completed Mar 29, 2022
@nomcopter
Copy link

@gaearon what are the advantages of that approach? Does the browser provide some normalization or other advantage?

@gaearon
Copy link
Collaborator Author

gaearon commented Mar 30, 2022

It's unfortunate to bundle a whole server renderer on the page just to produce HTML since you can already produce HTML just with React DOM. Additionally, if you do it in your component, you still have the context etc, which is what the original complaint was about.

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

No branches or pull requests

3 participants