Skip to content

Commit

Permalink
Add to code requirements install and import Interactivity API. (WordP…
Browse files Browse the repository at this point in the history
…ress#63439)

* Docs - reference guides - interactivity-api - Readme - Add to code requirements install and import Interactivity API.

* Update docs/reference-guides/interactivity-api/README.md

Co-authored-by: Nick Diego <[email protected]>

* Update docs/reference-guides/interactivity-api/README.md

Co-authored-by: Nick Diego <[email protected]>

---------

Co-authored-by: hectorjarquin <[email protected]>
Co-authored-by: ndiego <[email protected]>
Co-authored-by: colorful-tones <[email protected]>
Co-authored-by: juanmaguitar <[email protected]>
  • Loading branch information
5 people authored and carstingaxion committed Jul 18, 2024
1 parent 264e880 commit 361aab6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/reference-guides/interactivity-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,21 @@ You can start creating interactions once you set up a block development environm

### Code requirements

#### Add `interactivity` to your project

Install the Interactivity API to your project with the following command:

```bash
npm install @wordpress/interactivity --save
```

Import the store into your `view.js`. Refer to the [store documentation](https://developer.wordpress.org/block-editor/reference-guides/interactivity-api/api-reference/#the-store) for more information.

```js
import { store } from '@wordpress/interactivity';
```


#### Add `interactivity` support to `block.json`

To indicate that the block [supports](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/) the Interactivity API features, add `"interactivity": true` to the `supports` attribute of the block's `block.json` file.
Expand Down

0 comments on commit 361aab6

Please sign in to comment.