--

I actually refactor all my codebases to do the exact opposite of what you're suggesting. I always remove ternaries, especially useless ternaries that are end with null, because they're hard to read.

You shouldn't return 0 or undefined from a React component, and it's easy enough to check for the 0 and return null if that's a problem.

--

--

Dr. Derek Austin 🥳
Dr. Derek Austin 🥳

Written by Dr. Derek Austin 🥳

Hi, I'm Doctor Derek! I've been a professional web developer since 2005, and I love writing about programming with JavaScript, TypeScript, React, Next.js & Git.

No responses yet