You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if uncomment $effect() or $inpect() counter.count not update
<script>
let counter =$state({ count:0,increment(){this.count+=1}, });/* Any of the following lines breaks the updates */// $effect(() => { console.log(counter) }); // $inspect(counter)
</script>
<buttononclick={counter.increment}>
clicks: {counter.count}
</button>
The following fragment causes a loop when invoking increment
There's some DEV related code that makes your code example work, but really it shouldn't ever work as your event handler has a this of the button element. I'll fix that DEV bit of code, but you should probably avoid passing in the event handler directly and use an arrow function instead:
Describe the bug
counter.count
not updateclicking causes a loop
Reproduction
link1
link2
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: