Is possible to define a store independently from a block? #64643
johnhooks
started this conversation in
Interactivity API
Replies: 1 comment 3 replies
-
Absolutely, blocks and stores are independent, and you can organize them however you want. For example, you could have a single store defined in one file for all your blocks. Or you could have multiple store parts defined in different files that share the same namespace. Or you could define two different stores for a single block. It is up to you, depending on what you want to achieve and how your blocks relate to each other. The Interactivity API does not impose any restrictions. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
After reading through the wp-movies-demo example, I have a question about defining Interactivity API stores.
I noticed that some blocks rely on the state properties or actions defined in other blocks. For example the movie-trailer-button calls
setVideo
which is defined in video-player.Is possible to define a store independently from a block, so that can be included as a dependency for multiple blocks? This would keep all the shared logic for a store together, rather than being defined in pieces across multiple blocks. Otherwise a block can have a hidden reliance on state or actions defined in another block, which might not be included on the page.
Beta Was this translation helpful? Give feedback.
All reactions