Skip to content

Commit

Permalink
feat: setValues now receives a partial for convenience
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanfilhoz committed May 12, 2024
1 parent 5803662 commit 2e92f53
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
5 changes: 4 additions & 1 deletion src/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ export const useForm = <Input extends FormInput, FormResponse>({
}, [])

const setValues = useCallback((newValues: Input) => {
values.current = newValues
values.current = {
...values.current,
newValues
}
}, [])

const validate = useCallback(() => {
Expand Down

0 comments on commit 2e92f53

Please sign in to comment.