Skip to content

Commit

Permalink
refactor: change form options spread to object assign
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielModog committed Aug 30, 2023
1 parent 74a1dab commit 2038ca3
Show file tree
Hide file tree
Showing 2 changed files with 190 additions and 379 deletions.
4 changes: 3 additions & 1 deletion packages/react-form/src/createFormFactory.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { FormApi, FormOptions } from '@tanstack/form-core'

import { type UseField, type FieldComponent, Field, useField } from './useField'
import { useForm } from './useForm'

Expand All @@ -13,7 +14,8 @@ export function createFormFactory<TFormData>(
): FormFactory<TFormData> {
return {
useForm: (opts) => {
return useForm<TFormData>({ ...defaultOpts, ...opts } as any) as any
const formOptions = Object.assign({}, defaultOpts, opts)
return useForm<TFormData>(formOptions)
},
useField: useField as any,
Field: Field as any,
Expand Down
Loading

0 comments on commit 2038ca3

Please sign in to comment.