P粉7648364482023-07-30 00:41:26
You can create a shallow copy of formData.
const submitData = { ...formData };
Or use lodash's `cloneDeep` to make a deep copy.
const submitData = _.cloneDeep(formData);
Both create a new object with the same properties and values as the original object. However, the new object is a separate entity in memory from the original object. Modifications to the copy do not affect the original formData object.