From: Eduardo San Martin Morote Date: Wed, 4 May 2022 12:43:16 +0000 (+0200) Subject: docs: remove confusing example X-Git-Tag: @pinia/nuxt@0.1.9~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9cd76e7451bc744a82f28b339f4a75cdf1088495;p=thirdparty%2Fvuejs%2Fpinia.git docs: remove confusing example See #1204 --- diff --git a/packages/docs/core-concepts/state.md b/packages/docs/core-concepts/state.md index 14e149b9..ba17daf7 100644 --- a/packages/docs/core-concepts/state.md +++ b/packages/docs/core-concepts/state.md @@ -69,28 +69,7 @@ const useCounterStore = defineStore('counterStore', { }) ``` -### With `setup()` - -While Composition API is not for everyone, the `setup()` hook can make using Pinia easier to work with in the Options API. No extra map helper functions needed! - -```js -import { useCounterStore } from '../stores/counterStore' - -export default { - setup() { - const counterStore = useCounterStore() - - return { counterStore } - }, - computed: { - tripleCounter() { - return this.counterStore.counter * 3 - }, - }, -} -``` - -### Without `setup()` +#### Without `setup()` If you are not using the Composition API, and you are using `computed`, `methods`, ..., you can use the `mapState()` helper to map state properties as readonly computed properties: