Good point! That’s indeed correct. Both are mentioned in the documentation and serve different purposes. v-once removes the node from diffing in virtual-DOM, while Object.freeze() effectively prevents from tracking reactivity (akin to what was exemplified in the article).
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Another way to turn off reactivity on arrays or objects is to call Object.freeze() on it.
You can also use the v-once directive for a one time binding so that the dom element doesn't track the property for changes.
Good point! That’s indeed correct. Both are mentioned in the documentation and serve different purposes.
v-once
removes the node from diffing in virtual-DOM, whileObject.freeze()
effectively prevents from tracking reactivity (akin to what was exemplified in the article).