Interactivity API is a new API that allows developers to create interactive blocks in WordPress. It is built on top of the Block Editor and provides a way to create blocks that can interact with each other. Before the Interactivity API, developers had to rely on custom JavaScript code to create interactive blocks.
Some configurations are required to use the Interactivity API and its scripts. As @wordpress/intereactivity
provides its scripts as js module and we can only import use a module script in another module script.
To create a custom interactive block using the Interactivity API, you need to follow these steps: