DEV Community

loading...

Discussion on: When to avoid VueJs Computed Properties for greater performance

Collapse
raheel98 profile image
Raheel Khan

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.

Collapse
pecus profile image
Matteo Fogli Author

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).