The Interactivity API was recently released in WordPress 6.5. Now is the time to experiment with the API and incorporate interactions into your custom blocks, but where should you start?
Often, the best way to learn is through real-world examples. In this Developer Hours session, Damon Cook from WP Engine demonstrates how he built a form submission block that leverages the API. This example will teach you how to kickstart a custom interactive block using the Create Block package, use directives to assign critical attributes to your HTML markup, create the store, and hook up the client-side JavaScript.
Resources:
Damon's demo plugin: https://github.com/colorful-tones/feedback-block
Interactivity API documentation: https://developer.wordpress.org/block-editor/reference-guides/packages/packages-interactivity/
Tutorial on building a custom block: https://developer.wordpress.org/block-editor/getting-started/tutorial/
↧