const handleChange = (event) => {
const { name, value } = event.target;
Here is [name]
that is inside the square bracket. I know what it's doing but I just want to know what was the logic under the hood to use this logic?
setFormFields({ ...formFields, [name]: value });
console.log(formFields);
};
If it's array destructuring why and how is it working and why not object destructuring and what is the reason behind using this logic?