]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
docs: note about using `Vue.set()`
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 31 May 2021 14:28:57 +0000 (16:28 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 31 May 2021 14:28:57 +0000 (16:28 +0200)
Close #452

docs/core-concepts/state.md

index c0e9a425c986082c88e5666f349bb5a924bbccce..48a7bedc8f160398088f33314fbb3aeaca29a41e 100644 (file)
@@ -19,6 +19,10 @@ const useStore = defineStore({
 })
 ```
 
+:::tip
+If you are using Vue 2, the data you create in `state` follows the same rules as the `data` in a Vue instance, ie the state object must be plain and you need to call `Vue.set()` when **adding new** properties to it. **See also: [Vue#data](https://vuejs.org/v2/api/#data)**.
+:::
+
 ## Accessing the `state`
 
 By default, you can directly read and write to the state by accessing it through the `store` instance: