]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
docs: add unwrapping behavior
authorEduardo San Martin Morote <posva13@gmail.com>
Fri, 2 Apr 2021 14:08:54 +0000 (16:08 +0200)
committerEduardo San Martin Morote <posva@users.noreply.github.com>
Wed, 28 Apr 2021 17:45:38 +0000 (19:45 +0200)
docs/core-concepts/plugins.md

index a9d832d88c616dd8661c583829128f91bb6a3ff6..1b6816722ccc08845928e28c16dc31bdb9d672c5 100644 (file)
@@ -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: