]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
docs: add initial state value/reactivity section (#1675)
authorDario Regazzoni <dregazzoni@protonmail.com>
Thu, 6 Oct 2022 14:17:29 +0000 (16:17 +0200)
committerGitHub <noreply@github.com>
Thu, 6 Oct 2022 14:17:29 +0000 (16:17 +0200)
Co-authored-by: Eduardo San Martin Morote <posva13@gmail.com>
packages/docs/core-concepts/state.md

index aacf86a49dcade77b06211d297267ce2d546cafe..ded347f65f248cd9bba838613b37c8ccd2f9265a 100644 (file)
@@ -82,6 +82,8 @@ const store = useStore()
 store.count++
 ```
 
+Note you cannot add a new state property **if you don't define it in `state()`**, it must contain the initial state. e.g.: we can't do `store.secondCount = 2` if `secondCount` is not defined in `state()`.
+
 ## Resetting the state
 
 You can _reset_ the state to its initial value by calling the `$reset()` method on the store: