From: Tom Locke Date: Tue, 31 Aug 2021 09:21:52 +0000 (+0100) Subject: docs: use arrow function for state (#643) X-Git-Tag: @pinia/nuxt@0.0.2~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9ff5006526ce0bcb0afe2a79f388ab89439f155e;p=thirdparty%2Fvuejs%2Fpinia.git docs: use arrow function for state (#643) --- diff --git a/packages/docs/core-concepts/state.md b/packages/docs/core-concepts/state.md index b16d5945..2bf388c9 100644 --- a/packages/docs/core-concepts/state.md +++ b/packages/docs/core-concepts/state.md @@ -6,8 +6,8 @@ The state is, most of the time, the central part of your store. People often sta import { defineStore } from 'pinia' const useStore = defineStore('storeId', { - // can also be defined with an arrow function if you prefer that syntax - state() { + // arrow function recommended for full type inference + state: () => { return { // all these properties will have their type inferred automatically counter: 0, diff --git a/packages/docs/introduction.md b/packages/docs/introduction.md index 7dc00a6b..efc976ed 100644 --- a/packages/docs/introduction.md +++ b/packages/docs/introduction.md @@ -26,7 +26,7 @@ This is what using pinia looks like in terms of API (make sure to check the [Get import { defineStore } from 'pinia' export const useCounterStore = defineStore('counter', { - state() { + state: () => { return { count: 0 } }, // could also be defined as