Челендж: Створення Компонента Форми
Завдання
У цьому завданні вам потрібно створити компонент Form
з двома полями вводу: email
та password
. Мета полягає у використанні хука useRef
для посилання на елементи вводу та обробки логіки відправки форми.
Інструкції
- Імпортуйте хук
useRef
з бібліотекиreact
. - Усередині компонента
Form
оголосіть дві змінніuseRef
:emailRef
таpasswordRef
, ініціалізованіnull
. - Обнуліть поля введення, встановивши їх значення в порожній рядок за допомогою змінних
useRef
.
- To import the necessary hook from the React library, include an
import
statement. - For this task, we will utilize the
useRef
hook to store data without affecting the markup. - To determine the appropriate variable name for the ref, choose a word that is associated with the ref and add "Ref" at the end.
- To initialize the ref with
null
, passnull
as the initial value in the brackets of theuseRef
hook (e.g.,useRef(null)
). - To reset the form input, use the appropriate ref variable and assign its
.current.value
to an empty string (""
).
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 3. Розділ 5
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Awesome!
Completion rate improved to 2.17
Челендж: Створення Компонента Форми
Свайпніть щоб показати меню
Завдання
У цьому завданні вам потрібно створити компонент Form
з двома полями вводу: email
та password
. Мета полягає у використанні хука useRef
для посилання на елементи вводу та обробки логіки відправки форми.
Інструкції
- Імпортуйте хук
useRef
з бібліотекиreact
. - Усередині компонента
Form
оголосіть дві змінніuseRef
:emailRef
таpasswordRef
, ініціалізованіnull
. - Обнуліть поля введення, встановивши їх значення в порожній рядок за допомогою змінних
useRef
.
- To import the necessary hook from the React library, include an
import
statement. - For this task, we will utilize the
useRef
hook to store data without affecting the markup. - To determine the appropriate variable name for the ref, choose a word that is associated with the ref and add "Ref" at the end.
- To initialize the ref with
null
, passnull
as the initial value in the brackets of theuseRef
hook (e.g.,useRef(null)
). - To reset the form input, use the appropriate ref variable and assign its
.current.value
to an empty string (""
).
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 3. Розділ 5