From: Eduardo San Martin Morote Date: Mon, 11 Jul 2022 09:29:47 +0000 (+0200) Subject: docs: typos and references X-Git-Tag: @pinia/nuxt@0.2.0~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=08fa257f176e4183d05b8f4a6c0c0420c2ce238c;p=thirdparty%2Fvuejs%2Fpinia.git docs: typos and references Close #1441 --- diff --git a/packages/docs/core-concepts/state.md b/packages/docs/core-concepts/state.md index db47b014..a54b9b91 100644 --- a/packages/docs/core-concepts/state.md +++ b/packages/docs/core-concepts/state.md @@ -64,8 +64,8 @@ import { defineStore } from 'pinia' const useCounterStore = defineStore('counterStore', { state: () => ({ - counter: 0 - }) + counter: 0, + }), }) ``` @@ -129,7 +129,8 @@ Apart from directly mutating the store with `store.counter++`, you can also call ```js store.$patch({ counter: store.counter + 1, - name: 'Abalam', + age: 120, + name: 'DIO', }) ``` @@ -144,14 +145,14 @@ cartStore.$patch((state) => { -The main difference here is that `$patch()` allows you to group multiple changes into one single entry in the devtools. Note **both, direct changes to `state` and `$patch()` appear in the devtools** and can be time travelled (not yet in Vue 3). +The main difference here is that `$patch()` allows you to group multiple changes into one single entry in the devtools. Note **both, direct changes to `state` and `$patch()` appear in the devtools** and can be time traveled (not yet in Vue 3). ## Replacing the `state` You can replace the whole state of a store by setting its `$state` property to a new object: ```js -store.$state = { counter: 666, name: 'Paimon' } +store.$state = { counter: 24 } ``` You can also replace the whole state of your application by changing the `state` of the `pinia` instance. This is used during [SSR for hydration](../ssr/#state-hydration).