Weekly Vue News

By Michael Hoffmann (Mokkapps)

Weekly Vue News - #56 - Avoid Side Effects in Computed Properties

#56ใƒป
359

subscribers

61

issues

Subscribe to our newsletter

By subscribing, you agree with Revueโ€™s Terms of Service and Privacy Policy and understand that Weekly Vue News will receive your email address.

Michael Hoffmann (Mokkapps)
Michael Hoffmann (Mokkapps)
Hi ๐Ÿ‘‹
My code snippet tool is making good progress!
๐Ÿคฉ Every feature you see in the picture below will be part of the free version
๐Ÿคฉ Undo, Redo, Line Highlighting, blurring lines and many more
Stay tuned and have a great week โ˜€๏ธ

Vue Tip: Avoid Side Effects in Computed Properties
It is considered bad practice to introduce side effects inside computed properties and functions because it makes the code unpredictable and hard to understand.
What is a side effect? In the context of computed properties, a side effect is a modification of the stateโ€™s global state or the internal component state.
Letโ€™s take a look at an example with side effects:
Now letโ€™s change the code and remove the side effects:
Read this fantastic article from Michael Thiessen for more details about side effects.
Curated Vue Content
JavaScript Tip: Check Network Status
Curated Web Development Content
Quote of the Week
Did you enjoy this issue? Yes No
Michael Hoffmann (Mokkapps)
Michael Hoffmann (Mokkapps) @mokkapps

Hi ๐Ÿ‘‹

My name is Michael Hoffmann and I'm a Senior Frontend Developer, Freelancer and Blogger.

I focus on Vue.js, JavaScript, TypeScript and Spring Boot. Occasionally I also give career & freelancer advice.

My weekly emails reflect this preference.

In order to unsubscribe, click here.
If you were forwarded this newsletter and you like it, you can subscribe here.
Created with Revue by Twitter.
Holzapfelkreuther StraรŸe 19, 81375 Munich, Germany