Skip to content

fix: computed example should not mutate ref value #417

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

Merged

Conversation

skirtles-code
Copy link
Contributor

There are two problems with the existing example:

  1. Using count.value++ changes the value of count.value.
  2. Despite what it says on the next line, the logged value of plusOne.value will be 1, not 2. Note count.value++ is being used, not ++count.value.

Changing it to count.value + 1 fixes both problems.

Copy link
Member

@NataliaTepluhina NataliaTepluhina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix! 👍🏻

@NataliaTepluhina NataliaTepluhina merged commit fcc21b1 into vuejs:master Aug 20, 2020
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.

2 participants