The code below works fine and react re-render the child:
const [equip, setEquip] = useState({biAbt:[]});
const handleSet = (name, value) => {
setEquip({[name]: value});
}
But if i try set the state with an object there is no render:
const [equip, setEquip] = useState({biAbt:[]});
const handleSet = (name, value) => {
let obj = equip;
obj[name] = value;
setEquip(obj);
}
What am I doing wrong? I need to add or update a property to the existing state object.