Are there any semantic or performance differences between `Show` and ternaries?
The docs say:
It is similar to the ternary operator (when ? children : fallback) but is ideal for templating JSX.But I'm not sure in what way it's ideal for templating, is it talking about just DX or also ideal performance-wise?
5 Replies
Vanilla ternaries is bad in perf because it reconstructs the returned node every time the condition changes. The compiler optimizes this in JSX though and only in JSX. Show just makes it more consistent to do
does the jsx optimised ternary have any semantic or performance differences with
Show
?it's close to keyed
Show
and is there a penalty for using keyed when not needed?
non-keyed only checks for the boolean state, not the referential state