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
lxsmnsyc
lxsmnsyc•14mo ago
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
Samual 🦢
Samual 🦢•14mo ago
does the jsx optimised ternary have any semantic or performance differences with Show?
lxsmnsyc
lxsmnsyc•14mo ago
it's close to keyed Show
Samual 🦢
Samual 🦢•14mo ago
and is there a penalty for using keyed when not needed?
lxsmnsyc
lxsmnsyc•14mo ago
non-keyed only checks for the boolean state, not the referential state