WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
9.99k stars 4.02k forks source link

Docs: Interactivity API - Create and "Interactivity API" section under "How to Guides" section and include some initial guides #62922

Open juanmaguitar opened 1 week ago

juanmaguitar commented 1 week ago

There are some guides to complement the docs at Interactivity API Reference that could be added to a new "How to Guides > Interactivity API" section

Some of the guides that could go under this new section are:

WPLake commented 5 days ago

It would be nice to highlight the fact that iAPI can be used in any theme, including classic ones. Providing a small practical example would encourage developers to apply it even while developing classic themes.

Currently, it states that the API is public but does not provide a complete example. For instance, if developers try to use the @wordpress/interactivity alias directly, it won't work because WordPress doesn't define this alias automatically when it's used out of Gutenberg blocks.

Therefore, the example should describe the way to 'enable' the alias, or at least mention that the full root path (/wp-includes/...) is necessary for usage. Otherwise, many developers might feel that using iAPI outside of Gutenberg is not expected or encouraged.

juanmaguitar commented 4 days ago

It would be nice to highlight the fact that iAPI can be used in any theme, including classic ones. Providing a small practical example would encourage developers to apply it even while developing classic themes.

@WPLake, this sounds like a great guide for the "How-to Guides > Interactivity API." Would you be up to writing this guide?

If the guide becomes too long, or it turns out to more like a tutorial, it could be suggested as a Developer Blog post and just link it from "How-to Guides > Interactivity API."