No, people aren’t using if
statements for assignment very commonly at all in JavaScript, not when you have ?
, ?.
, &&
, ||
, and ??
as options.
And React developers have to significantly rearchitect the JSX in their return statements if they want to replace a ?
(or &&
) for conditional rendering with guard clauses (if x return <>X</>
).
Of course, if
(and, for some developers, else
) are commonly used for branching code — executing different statements based on certain conditions being met. But they’re not common with =
assignment.