Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix recommended syntax for getters as reactive data sources #2569

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

billyschonenberg
Copy link

@billyschonenberg billyschonenberg commented Nov 14, 2023

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!

update example by recommended syntax
Copy link

netlify bot commented Nov 14, 2023

Deploy Preview for vuejs ready!

Name Link
🔨 Latest commit acaab7a
🔍 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.

@billyschonenberg billyschonenberg changed the title docs: fix recommended syntax docs: fix recommended syntax for getters as reactive data sources Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant