-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Question: Request for Block hydration example #5998
Comments
Hi @rufioTR, This doesn't seem like a noobish question to me. :) But the amount of friction one must overcome to hydrate a block as a React component makes me think it is not an expected use case, at least not yet. Here are some reasons:
save: () => (
<div class="my-block-container">
<FrontendComponent />
</div>
) Then you'd need to query for elements with that class, and hydrate in those containers.
It would be nice if it was natural to add handlers such as You may already know this, but you can specify a script to load with your block type on the front-end via NOTE: I believe the above is correct but am far from a Gutenberg expert. @gziolo, is there anything you would correct or add here? |
Yes, that's the thing. We don't support rehydrating on the front-end at all. We only render saved HTML with HTML comments stripped. To make it work you would have to use the same |
By the way, I did some exploration how to render React components on the front-end in #5691, but I didn't get to make it work with blocks. I'm sure it is going to be explored in the future, but definitely not before Gutenberg gets merged into WordPress core. I'm closing this issue, but feel free to ask more questions related to this topic. |
Maybe it's a kind of noobish question, but I'm looking for a solid way (as far as "solid" can be a word in the current gutenberg process ;)) to hydrate blocks on the client side.
example:
with this approach the click event won't fire (server side rendering)
can anybody help me out here to hydrate the block and "reactivate" the events?
Thanks a lot :)
The text was updated successfully, but these errors were encountered: