Ternary State
Handling Boolean State
Often times with Javascript we use boolean as variables, but usually when parsing the result to DOM we want it in a different form. In this case we use ternary operator as our state expression i.e {{<state>?<truthy>:<falsy>}}
.
import Keet from 'keet'
class App extends Keet {
el = 'app'
status = false
render(){
return 'Hello {{status?World:Keet}}'
}
}
const app = new App()
Codepen Sample
See the Pen Keetjs - Ternary State by Shahrul Nizam b. Selamat (@syarul) on CodePen.