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