From: Dario Regazzoni Date: Thu, 6 Oct 2022 14:17:29 +0000 (+0200) Subject: docs: add initial state value/reactivity section (#1675) X-Git-Tag: @pinia/nuxt@0.4.3~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6abf08fdba555731421893cf037d27269e76a55e;p=thirdparty%2Fvuejs%2Fpinia.git docs: add initial state value/reactivity section (#1675) Co-authored-by: Eduardo San Martin Morote --- diff --git a/packages/docs/core-concepts/state.md b/packages/docs/core-concepts/state.md index aacf86a4..ded347f6 100644 --- a/packages/docs/core-concepts/state.md +++ b/packages/docs/core-concepts/state.md @@ -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: