Loading…
Loading…
Main had a simple TodoList that only rendered the array. A colleague from an OOP background sent a PR that adds interactivity: toggle, addTag, sort. It compiles, but QA complains that tasks "sometimes don't update". Walk the diff and find the mutations.
React re-renders when it sees state changed. "Changed" is decided by `Object.is(prev, next)`: **by reference**, not by contents. That means: if you mutate an object/array and pass it back to setState, React concludes nothing changed — and won't re-render. The UI stays stale. Forbidden methods: `push`, `pop`, `shift`, `splice`, `sort`, `reverse`, direct assignment (`obj.field = x`). Walk the PR and find every mutation.