From 2e92f53c629e73587ed1df07f108657b31b6651c Mon Sep 17 00:00:00 2001 From: Ivan Filho Date: Sun, 12 May 2024 04:35:06 -0300 Subject: [PATCH] feat: setValues now receives a partial for convenience --- package.json | 2 +- src/useForm.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 5a9bce9..f966811 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "safe-form", - "version": "0.4.0", + "version": "0.5.0", "description": "⚡️ End-to-end type-safety from client to server.", "main": "dist/safe-form.es.js", "types": "dist/index.d.ts", diff --git a/src/useForm.ts b/src/useForm.ts index 22fc54f..c557b4d 100644 --- a/src/useForm.ts +++ b/src/useForm.ts @@ -82,7 +82,10 @@ export const useForm = ({ }, []) const setValues = useCallback((newValues: Input) => { - values.current = newValues + values.current = { + ...values.current, + newValues + } }, []) const validate = useCallback(() => {