Skip to content

Commit

Permalink
Explicit title for store props destructuring (#2282)
Browse files Browse the repository at this point in the history
* Explicit title for  store props destructuring

I' m pretty sure lots of people are googling how to destructure the store. Let's make it easy with a nice and beautiful title

* Update packages/docs/core-concepts/index.md

---------

Co-authored-by: Eduardo San Martin Morote <[email protected]>
  • Loading branch information
DespertaWeb and posva authored Jun 28, 2023
1 parent 234e523 commit 88c9847
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/docs/core-concepts/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ const doubleValue = computed(() => store.doubleCount)
</script>
```

## Destructuring from a Store

In order to extract properties from the store while keeping its reactivity, you need to use `storeToRefs()`. It will create refs for every reactive property. This is useful when you are only using state from the store but not calling any action. Note you can destructure actions directly from the store as they are bound to the store itself too:

```vue
Expand Down

0 comments on commit 88c9847

Please sign in to comment.