We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
setData
useForm
1 parent f47d3c4 commit bfdb56eCopy full SHA for bfdb56e
packages/react/src/useForm.ts
@@ -170,7 +170,7 @@ export default function useForm<TForm extends FormDataType>(
170
data,
171
setData(keyOrData: keyof TForm | Function | TForm, maybeValue?: TForm[keyof TForm]) {
172
if (typeof keyOrData === 'string') {
173
- setData({ ...data, [keyOrData]: maybeValue })
+ setData((data) => ({ ...data, [keyOrData]: maybeValue }))
174
} else if (typeof keyOrData === 'function') {
175
setData((data) => keyOrData(data))
176
} else {
0 commit comments