Skip to content

Commit

Permalink
refactor(react): silent useForm for child form sence (#2302)
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang authored Oct 14, 2021
1 parent f5dd229 commit c2c2e30
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions packages/react/src/hooks/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,5 @@ import { Form } from '@formily/core'
import { FormContext } from '../shared'

export const useForm = <T extends object = any>(): Form<T> => {
const form = useContext(FormContext)
if (!form) {
throw new Error('Can not found form instance from context.')
}
return form
return useContext(FormContext)
}

0 comments on commit c2c2e30

Please sign in to comment.