From 21f0ce5cd51c9e02cefd9b2127a98c0ffd59b905 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Fri, 2 Apr 2021 16:08:54 +0200 Subject: [PATCH] docs: add unwrapping behavior --- docs/core-concepts/plugins.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/core-concepts/plugins.md b/docs/core-concepts/plugins.md index a9d832d8..1b681672 100644 --- a/docs/core-concepts/plugins.md +++ b/docs/core-concepts/plugins.md @@ -58,6 +58,18 @@ pinia.use(({ store }) => { }) ``` +Note that every store is wrapped with [`reactive`](https://v3.vuejs.org/api/basic-reactivity.html#reactive), automatically unwrapping any Ref (`ref()`, `computed()`, ...) it contains: + +```js +pinia.use(({ store }) => { + store.hello = ref('secret') + // it gets automatically unwrapped + store.hello // 'secret' +}) +``` + +This is why you can access all computed properties without `.value`. + ## TypeScript A Pinia plugin can be typed as follows: -- 2.47.2