Why Not use AND (&&) Operator for Conditional Rendering in React

in reactjs •  2 years ago 

Don't use AND operator ANYMORE in react component. This small video explains the deadly problem can a && operator cause in your react application. Along with the solution, what to use instead of an operator in react.

Apart form that we also going to talk about the Short circuit evaluation effect in react and why not use that instead?

0:00 Why not user and operator in React.js
0:53 Why AND operator usually create UI bugs ?
1:50 How AND operator works in React.js?
3:26 What is Short circuit evaluation in react?
5:20 Problem caused by And operator in react.
7:37 Why AND operator causes an error with an undefined value?
9:20 What to use instead of "AND operator" in react ?
9:50 Why use the ternary operator in react?
10:13 Benefits of using the ternary operator in react.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!