React | Updating Objects in React with useState
Starting Point
Here's a basic useState setup:
Initial values
const [person, setPerson] = useState({
name: "peter",
age: 24,
hobby: "read books",
});
The Mistake
If you try to update only one property like this:
setPerson({ name: "susan" });
Y...
val-codeops.hashnode.dev1 min read