Chained Short Circuit Conditionals in JSX
See original GitHub issueJust upgraded to 1.6.1 and noticed that chained “short circuit” conditionals no longer get indented. Is this intentional?
v1.5.3
const Foo = (bar, baz) =>
<div>
{bar &&
baz &&
<span>hello there. make this long enough to wrap to the next line</span>}
</div>
v1.6.1
const Foo = (bar, baz) => (
<div>
{bar &&
baz && (
<span>hello there. make this long enough to wrap to the next line</span>
)}
</div>
)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:9 (8 by maintainers)
Top Results From Across the Web
React conditional rendering: 9 methods with examples
Learn how to do conditional rendering in React. ... React element variables; The ternary operator in React; Short-circuit AND operator ...
Read more >How to Level Up Your React Conditionals - freeCodeCamp
Use the ternary operator to write conditionals in your JSX However, what if we don't want to write a conditional separate from our...
Read more >How to do a nested if else statement in ReactJS JSX?
Here's an article on conditional rendering in React, so please check it out if you're interested in more details on this topic.
Read more >React Conditional Rendering - Robin Wieruch
Everything you need to know about conditional rendering in React. ... It's also called short-circuit evaluation which makes it even more ...
Read more >Short Circuit Evaluation with React - DEV Community
Rendering these components using conditional rendering is something I enjoy coding, and I'm not sure why. It's not hard, it's sometimes not easy ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@suchipi thanks for the context 😃 Enjoy your new place!
Not intentional; this is a bug.
Should we change it to A:
B:
or C?
(Or something else).
My preference is C or A.