Closed
Description
Given this change facebook/react#14752 mutating state (arrays or objects) no longer works at all. New objects must be constructed every time with Object.assign, or if arrays are used they must be cloned, mutated and returned.
Examples of doing that with both objects and arrays would be helpful, especially with the form that takes a function:
const [list, setList] = useState([])
setList((l) => {
l.push(1)
return l
}
Metadata
Metadata
Assignees
Labels
No labels