Watch mutation or state #1218
-
Hello, as watching Is there a way to subscribe to a specific mutation or state change? This problem with the solution belove is that the .key property is removed in the prod bundle.
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
You can just watch the property directly: watch(() => dashboardStore.dashboardLoacked, ...) |
Beta Was this translation helpful? Give feedback.
-
I still don't understand how to subscribe on specific state changes((
how to get callback on arr changes only? not count |
Beta Was this translation helpful? Give feedback.
-
In yout component where you want to react to the change
|
Beta Was this translation helpful? Give feedback.
-
It happens the same to me, in the Docs is not clear how to subscribe to state in the Store. Exmple:
I'd like to subscribe to category so it triggers the getBooks() actions anytime category is changed in the store so all the logic is bundled no in the component but in the store |
Beta Was this translation helpful? Give feedback.
You can just watch the property directly: