docs icon indicating copy to clipboard operation
docs copied to clipboard

docs: fix recommended syntax for getters as reactive data sources

Open billyschonenberg opened this issue 2 years ago • 1 comments

Description of Problem

With the addition of toValue in vue 3.3, there is a new syntax so we can use getters as reactive data sources. Here is the announcement. https://blog.vuejs.org/posts/vue-3-3#better-getter-support-with-toref-and-tovalue

The example used in the this post is :

// after: more efficient and succinct
useFeature(() => props.foo)

In the api docs:

// getter syntax - recommended in 3.3+
useSomeFeature(toRef(() => props.foo))

Although this section is about toRef(), I think users should be guided that there is a new implementation using getters with toValue

I think the recommended getter syntax should be useSomeFeature(() => props.foo)

Proposed Solution

Update the docs, please see changes.

Thanks!

billyschonenberg avatar Nov 14 '23 11:11 billyschonenberg

Deploy Preview for vuejs ready!

Name Link
Latest commit acaab7a6bfb90f9c17dda0c2a2497d2357b981a2
Latest deploy log https://app.netlify.com/sites/vuejs/deploys/655365d817540f0008dba166
Deploy Preview https://deploy-preview-2569--vuejs.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Nov 14 '23 11:11 netlify[bot]