Re:Advice on JSX Conditionals
by eyelidlessness on Wednesday March 09, 2022 @07:38PM
(#30621875)
I already responded down thread because I didn’t see this comment first. But I’ll add that your console log example is more analogous to the JSX control flow question as:
someBool && console.log(“anything”)
Hope this helps.
If you write
Are you altering the control flow because the console window will call a different bit of font evaluation code to render “anything” instead of “false”?Or are you just conditionally evaluating an expression that results in different data that causes different downstream effects?
Evaluating <Anything/> doesn’t do anything. It doesn’t make any DOM elements. It doesn’t trigger any useEffects. It just returns an object that has the potential to be hooked into a react renderDOM lifecycle to provide further instructions on what the DOM should look like and what other core should run.