Recently I've created a Sanity.io - Gatsby.js project. And the current project I'm working on is a Wordpress website. Now, I'm working for the first time on a custom Gutenberg Block and was happy to find out a big part of it is in Javascript.
I was happy to start learning more about this. But soon I found out that Gutenberg, when it comes to dynamic content, immediately jumps back to PHP with a callback. And from there on, it's well, php.
So that got me wondering. Is there a way to avoid PHP in gutenberg blocks? And work with React Functional Components. As a "simple" learning project I want to create the following.
Thoughts
Now, I won't expect you guys to write me a block :) But any pointers/ tutorials/ known (git)projects are more than welcome.
As of now, no, you cannot write dynamic Gutenberg blocks purely in React without PHP. The linked issue goes in good detail why you have to use at least some PHP , and various approaches people have taken to minimize making duplicate PHP and JS.