const choo = require('../../')
const html = require('../../html')
const app = choo()
app.model({
namespace: 'input',
state: {
title: 'my demo app'
},
reducers: {
update: (state, data) => ({ title: data.payload })
},
effects: {
update: (state, data, send, done) => {
document.title = data.payload
done()
}
}
})
const mainView = (state, prev, send) => {
return html`
${state.input.title}
send('input:update', { payload: e.target.value })}>
`
}
app.router(['/', mainView])
const tree = app.start()
document.body.appendChild(tree)