• Hi, everyone.

    I’m new to WP, so I just want to make sure I have understood this correctly;

    When developing a static block both the block editor (back end) markup and the front end markup can be done in JS/JSX.

    However, when developing a dynamic block, the markup for the front end must happen in the plugin.php file – is that correct?

    You see, the reason I ask is that I am a React developer, and my php skills are very poor. So naturally, I would love to be able to develop as much as possible in JS/JSX.

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    The distinction between JSX or PHP isn’t static vs. dynamic, it’s server side vs. client side. If your JSX has all the data it needs, it could dynamically render a block client side. If it lacks data, it could fetch it through the REST API.

    PHP is more of a fallback when it’s impractical to dynamically render client side. From the Creating dynamic blocks page of the Block Editor Handbook:

    Server-side render is meant as a fallback; client-side rendering in JavaScript is always preferred

Viewing 1 replies (of 1 total)
  • The topic ‘Dynamic Block Development’ is closed to new replies.