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•2y 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 🦢OP•2y ago
does the jsx optimised ternary have any semantic or performance differences with Show?
lxsmnsyc
lxsmnsyc•2y ago
it's close to keyed Show
Samual 🦢
Samual 🦢OP•2y ago
and is there a penalty for using keyed when not needed?
lxsmnsyc
lxsmnsyc•2y ago
non-keyed only checks for the boolean state, not the referential state
Want results from more Discord servers?
Add your server