3 ms·
Ok, I should probably edit my comment to "JSX/TSX feels so incredibly natural except for needing to use JS ternaries for conditional rendering" because seriousl
by yodon 7y ago
Ok, I should probably edit my comment to "JSX/TSX feels so incredibly natural except for needing to use JS ternaries for conditional rendering" because seriously what were they thinking there?
- steinuil 7y agoThis is more of an issue with JS than React. ReasonML also has JSX support and since `if` is an expression rather than a statement you can do this: <div> {if (cond) { <Comp1 /> } else { <Comp2 /> }} </div> Or even: <div> {switch (expr) { | A => <CompA /> | B => <CompB /> | _ => <CompC /> }} </div>
- ducaale 7y agomaybe do-expression proposal could help https://github.com/tc39/proposal-do-expressions https://github.com/tc39/proposal-do-expressions