3 ms·
Or, no need to enable anything: {user ? <Logout \> : <Login \> }
by Izkata 5y ago
Or, no need to enable anything:
{user
? <Logout \>
: <Login \>
}
- couchand 5y agoOk this thread just reached peak JavaScript.
- christophilus 5y agoTernary expressions have been around long before JavaScript was a twinkle in Brandon Eich’s eyes.
- 9wzYQbTYsAIc 5y agoJust modern ECMA Script, not peak JavaScript. ES6 and React Hooks have fully sublimated the web development landscape.
- hombre_fatal 5y agoYes, my example is trivial, but if-else can easily outgrow the ternary. The do-expression lets you embed arbitrary statements.