Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
swap(ctx, state => {
const newState = {
...initial,
...(state.forms[id] || {}),
...patch,
};
const updatedState = getNewFormState(newState, patch);
return {
...state,
forms: updateKey(state.forms, id, updatedState),
};
});
}