basic
const render = require('brisky/render')
const app = render({
class: 'app' // → add class 'app'
})
document.body.appendChild(app)
nested
const render = require('brisky/render')
const s = require('vigour-state/s')
const state = s({
class: true
})
const app = render({
class: {
val: 'css-class', // → add class "simple-class"
'state-class': { $: 'class' }, // → add class "state-class" (state.class is true)
'simple-class': true, // → add class "simple-class"
'other-class': false // → will remove class "other-class" if it's defined
}
}, state)
state.class.set(false) // → remove class "state-class"
state.class.set('bla') // → adds class "bla"
document.body.appendChild(app)
key
const render = require('brisky/render')
const app = render({
field: {
class: true // → add class "field"
},
other: {
class: {
useKey: true, // property forces use of a key
val: 'some-class' // → className "other some-class"
}
}
})
document.body.appendChild(app)