React Fundamentals

0% completed

Previous
Next
Quiz
Question 1
What is a controlled component in React forms?
A
A component where form data is handled by the DOM itself
B
A component where form data is controlled by React state
C
A component that does not require event handlers
D
A component that can only be used inside class components
Question 2
Which of the following is an example of an uncontrolled component?
A
<input value={name} onChange={handleChange} />
B
<input ref={inputRef} />
C
<textarea value={text} onChange={handleChange} />
D
<select value={option} onChange={handleChange} />
Question 3
How do you access the value of an uncontrolled input field in React?
A
Using event.target.value inside an onChange handler
B
Using useState and updating the state on every change
C
Using the ref attribute and accessing inputRef.current.value
D
Using the value attribute directly
Question 4
Which hook is commonly used to manage form state in controlled components?
A
`useState
B
useRef
C
useEffect
D
useReducer

.....

.....

.....

Like the course? Get enrolled and start learning!
Previous
Next