Skip to content

Commit 874be8a

Browse files
committed
Change input to use useFormContext hook
1 parent edfb7fb commit 874be8a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/input/Input.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { HTMLProps, useContext, useState, useEffect } from 'react';
22
import classNames from 'classnames';
33
import Hint from '../hint';
4-
import FormContext, { IFormContext } from '../form/FormContext';
4+
import { useFormContext } from '../form/FormContext';
55
import ErrorMessage from '../error-message';
66

77
interface InputProps extends HTMLProps<HTMLInputElement> {
@@ -22,7 +22,7 @@ const Input: React.FC<InputProps> = ({
2222
error,
2323
...rest
2424
}) => {
25-
const { isForm, setError } = useContext<IFormContext>(FormContext);
25+
const { isForm, setError } = useFormContext();
2626
const [name] = useState<string>(
2727
rest.name || `input_${(Math.random() + 1).toString(36).substring(2, 7)}`,
2828
);

0 commit comments

Comments
 (0)