I am using dreamland.js to write a simple application. I expect the text in the “preview” section to update when I set the value in state
, but it’s not updating despite the value clearly being changed. Code is below
import "dreamland/dev";
let state = stateful({
currentText: ""
})
function Editor() {
return (
<div id="editor">
<textarea
value={state.currentText}
on:input={(e: InputEvent) => {
state.currentText = e.target!.value
console.log(state.currentText)
}}
autofocus
/>
<div id="preview">
{state.currentText}
</div>
</div>
)
}
function MainApp() {
return (
<div id="app">
<Editor />
</div>
)
}
window.addEventListener('load', () => {
document.body.appendChild(<MainApp />)
})