From: Eduardo San Martin Morote Date: Fri, 2 Apr 2021 14:08:54 +0000 (+0200) Subject: docs: add unwrapping behavior X-Git-Tag: v2.0.0-alpha.14~35 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=21f0ce5cd51c9e02cefd9b2127a98c0ffd59b905;p=thirdparty%2Fvuejs%2Fpinia.git docs: add unwrapping behavior --- 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: