-
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
Framework: Try to render React based components on the frontend #5691
Conversation
I'm a bit worried about the idea of wanting or encouraging this behavior for a few reasons:
Related: https://make.wordpress.org/core/2017/01/17/editor-technical-overview/ |
Thanks for exploring this folks. I will follow your lead and ideas here, but my 2 cents for what it may be worth.
Totally understand that this does break from the core convention of how block data is saved and displayed so it may just remain something people hack to make work on the frontend as needed, but since React is in Core it seemed something to explore. Thanks! Know ya'll are crazy busy :) |
@aduth, I probably shouldn't include the changes to the latest posts block to better express my intent :)
What @zgordon said was the primary reason I started those explorations. I wanted to share an example how you can use
I wanted also to experiment with the block parsing on the frontend and find a way to add some interactions for the rendered HTML. Example use case would be the slideshow block, which is a mix of gallery and cover image. On the frontend users expect to have it animated. Our current setup would only generate HTML code and would defer the rest to the custom code which probably would need to be implemented with jQuery as of today. @westonruter, as explained above. My concern wasn't about the latest posts block. It doesn't explain well what I was trying to achieve. It's a different discussion if we really need server-side rendering for a very small group of blocks which don't add too much value to the SEO score, which I don't think makes sense before we have 5.0 out :) Backwards compatibility should be our priority for the time being 👍 I'm closing this one as I don't plan to work on it in the upcoming weeks. However, I'm happy to help with any efforts to make it work. Feel free to ping me if you need any help. @zgordon, there should be a few of us at WC EU, we might use the contributor day to spend some time on this amazing idea. Thanks for your feedback! |
Description
This is just an experiment to explore how much work it is needed to make it possible to render blocks also on the frontend.
I was able to render an existing component with not that much code. I also disable the part that strips demarcation comment and renders callback for the Latest Posts block which allows producing the following code on the frontend.
Next steps
edit
.Issues discovered
withAPIData
depends on theeditor
module's code because it uses context with some props declared there. It is going to be replaced soon withdata
module so we should rather focus on that at the moment. See #5219 for more info.