From c57a17f0059b1f85078f67c9d36d1eb7b70c6b06 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Tue, 25 Jul 2023 08:57:58 +0200 Subject: [PATCH] docs: note about state in setup stores See vuejs/pinia#2324 --- packages/docs/core-concepts/index.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/docs/core-concepts/index.md b/packages/docs/core-concepts/index.md index 2eab5b4da5..81fdb86f83 100644 --- a/packages/docs/core-concepts/index.md +++ b/packages/docs/core-concepts/index.md @@ -68,6 +68,8 @@ In _Setup Stores_: - `computed()`s become `getters` - `function()`s become `actions` +Note you **must** return **all state properties** in setup stores for pinia to pick them up as state. In other words, you cannot have _private_ state properties in stores. + Setup stores bring a lot more flexibility than [Option Stores](#option-stores) as you can create watchers within a store and freely use any [composable](https://vuejs.org/guide/reusability/composables.html#composables). However, keep in mind that using composables will get more complex when using [SSR](../cookbook/composables.md). Setup stores are also able to rely on globally _provided_ properties like the Router or the Route. Any property [provided at the App level](https://vuejs.org/api/application.html#app-provide) can be accessed from the store using `inject()`, just like in components: