From 08fa257f176e4183d05b8f4a6c0c0420c2ce238c Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Mon, 11 Jul 2022 11:29:47 +0200 Subject: [PATCH] docs: typos and references Close #1441 --- packages/docs/core-concepts/state.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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). -- 2.47.2