What is the purpose of the
useStatehook in React?To bind an event handler to an element.
To bind a value to the props of a component.
To manage the component's state
To manage the component's context
What is missing from the code below?
import { useState } from "react"; export default function App() { const [restaurantName, setRestaurantName] = useState(); return <h1>{restaurantName}</h1>; }The
setRestaurantNamefunction.The
useStatehook import statementuseReducerhook was not usedAn initial value for the state variable
restaurantName
Controlled components keep their internal state in the DOM
True
False
What is unit testing in React?
A type of testing that ensures that individual units of code are working as intended.
A type of testing that ensures that a complete application is working as intended.
A type of testing that involves manually testing a component's UI.
A type of testing that ensures that a component's props and state are correctly being passed down to its children.
What is the main difference between the
useStateanduseReducerhooks in React?useStateis used for managing component state, whileuseReduceris used for managing the component lifecycle.useStateis used for managing component state, whileuseReduceris used for managing the component's UI.useStateis used for managing component state, whileuseReduceris used for managing global state.useStateis used for simple state updates, whileuseReduceris used for complex state updates.

