-
-
Notifications
You must be signed in to change notification settings - Fork 929
Closed as not planned
Labels
Area: CoreFor anything dealing with Mithril core itselfFor anything dealing with Mithril core itselfType: GotchaFor unwanted behavior that is still correct under the given circumstancesFor unwanted behavior that is still correct under the given circumstances
Description
Is there an existing issue for this?
- I have searched the existing issues
Mithril.js Version
2.2.2
Browser and OS
Chrome latest, Ubuntu 22.04
Project
No response
Code
import m from 'mithril'
const state = { count: 0 }
const actions = {
increment: () => state.count += 1,
decrement: () => state.count -= 1
}
const Counter = {
oninit() {
document.getElementById('r1_1').textContent = state.count
},
view: () => {
return (
<div>
<button onclick={actions.increment}>+</button>
<button onclick={actions.decrement}>-</button>
<h2>Not work:</h2>
<div>textContent:<span id="r1_1">{state.count}</span></div>
<h2>Control group:</h2>
<div>{state.count}</div>
</div>
)
}
}
m.mount(document.getElementById("app"), {
view: () => <Counter></Counter>
})
- See the complete repo: https://github.com/up9cloud/mithril.js-issues-2962
Steps to Reproduce
See the code
Expected Behavior
It should redraw
Observed Behavior
It didn't redraw
Context
No response
Metadata
Metadata
Assignees
Labels
Area: CoreFor anything dealing with Mithril core itselfFor anything dealing with Mithril core itselfType: GotchaFor unwanted behavior that is still correct under the given circumstancesFor unwanted behavior that is still correct under the given circumstances