Skip to content

Commit

Permalink
[@mantine/form] useFormContext remove Throw Error
Browse files Browse the repository at this point in the history
  • Loading branch information
vaynevayne committed May 19, 2023
1 parent cd4a0a8 commit 9502167
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/mantine-form/src/FormProvider/FormProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { createContext, useContext } from 'react';
import { UseForm, UseFormReturnType, _TransformValues } from '../types';
import { useForm } from '../use-form';
import { UseFormReturnType, UseForm, _TransformValues } from '../types';

export interface FormProviderProps<Form> {
form: Form;
Expand All @@ -22,7 +22,8 @@ export function createFormContext<
function useFormContext() {
const ctx = useContext(FormContext);
if (!ctx) {
throw new Error('useFormContext was called outside of FormProvider context');
// eslint-disable-next-line no-console
console.warn('useFormContext was called outside of FormProvider context');
}

return ctx;
Expand Down

0 comments on commit 9502167

Please sign in to comment.