we use conditions everywhere on our applications whether for state check or rendering some data into the view depending on some parameters. in this...
For further actions, you may consider blocking this person and/or reporting abuse
Just one simple piece of advice: Instead of using 4 spaces for indentation in code snippets for blogs, I think it's better to use 2 spaces as it reduces the need for horizontal scrolling.
Great read. 👌
thanks for this advice 🤍
How about using the tab character? That what it is meant for and every one can set the space to what ever fits best for one.
github.com/gvergnaud/ts-pattern
this is also a good alternative
will try it thanks 💕
As always, all gold is in comments :)
beautiful stuff! rust inspired, perhaps?
Nice read!! a little improvement for the action array.
create a type of actions
then
Voila!
no one should add something weird within 😏
...
that's a great one thanks
didn't expect that anyone would see this post
I think this is not a matter of condition. It's a matter of good practice. Example 1 is easy to understand for beginners, but the other one is good to maintain and easy to extend.
it's a better way to write conditions as you said easy to maintain , extend and debug
This is great!
You get to simplify things further by creating objects with properties that point to specific values instead of checking nonstop for multiple values.
that's exactly it
this is awesome
you are awesome
Really Great Approach, Surely i am going to use in my Project, Awsome Thanks!
that's awesome, have a good one
imperative vs declarative
One more small advice. Just use ENUM for those roles across the project.
Thank you for posting, I am aspiring to be able to write and understand fluently! Reading these articles from inside perspectives helps tremendously!
glad to hear that 🤍
Thank you 🙏
You're welcome 💕
There is nothing wrong with conditions, you just reshaped the data you are working with
exactly, there is nothing wrong with conditions anyways , it's just a better approach
Amazing tip!
thanks <3
You are doing great
thanks 💕
Well executed!
thanks 🤍
Nice one!!!
thanks :)
thanks 👌
you are welcome 😌🤍
very understandable.
thanks 🤍🔥
no thank you. Over-abstractions are harder to maintain when the app grows.
Over-abstractions ?
so when your app grows abstractions is harder to maintain.
Ok
Exactly.
Well explained!
thanks 🤍
Nice code
thanks 🤍
Brilliant <3
thanks 🤍
Nice explanation.
thanks 🤍
Nice
thanks 🤍
Nice. Thank you for this
thanks 🤍😌
I like this.
thanks 🤍
Greate!!!!!
thanks 😌
great
thanks ♥️
Perfect explanation!!!
simple way to do clean code :)
happy to hear that 💕