well, i have an object inside another object, and i want to update the state in one property or more in the second object, this is the state :
const [products, setProducts] = useState({
name: '',
type: '',
price: '',
sizes: { s: false, m: false, l: false, xl: false }
});
how can i access a property in the second object i've tried this but it's not working :
setProducts({...products, sizes : {...sizes, sizes[m] : true}}) // this not working
is there any way to do this ?
Try this one.