How to render initial posts on page load in a Gutenberg block using the Interactivity API?
You could consider running actions.getPosts on mount via data-wp-init like: <div … data-wp-init=”actions.getPosts”> As per the documentation: This directive runs a callback only when the node is created. You could also consider server-rendering the initial set of posts, like: <div data-wp-watch=”callbacks.renderContent”> <?php $query = new WP_Query( array( … ) ); ?> <?php while( $query->have_posts() ) … Read more