From 361aab6eb26d45a17e4fd5b4c5b0e87069fa1e85 Mon Sep 17 00:00:00 2001 From: Hector Jarquin Date: Thu, 11 Jul 2024 11:45:59 -0400 Subject: [PATCH] Add to code requirements install and import Interactivity API. (#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 * Update docs/reference-guides/interactivity-api/README.md Co-authored-by: Nick Diego --------- Co-authored-by: hectorjarquin Co-authored-by: ndiego Co-authored-by: colorful-tones Co-authored-by: juanmaguitar --- docs/reference-guides/interactivity-api/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/reference-guides/interactivity-api/README.md b/docs/reference-guides/interactivity-api/README.md index 0b458a95fe6985..9648b0118a5aa1 100644 --- a/docs/reference-guides/interactivity-api/README.md +++ b/docs/reference-guides/interactivity-api/README.md @@ -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.