Which of the following hooks is used to manage local state in functional components?
- componentDidMount
- this.state
- useEffect
- useState
useState is the React hook used to manage local state in functional components. It allows functional components to maintain their state without using class components. useEffect is used for side effects and lifecycle methods like componentDidMount are used in class components, not functional ones. this.state is used in class components but not with hooks.
Loading...
Related Quiz
- Which of the following is a benefit of using Websockets for real-time applications in React?
- In MobX, the ________ function can be used to observe changes in observables and react to those changes.
- For global state management in a React application, one can use the ________ API.
- What is React-Intl?
- You're working on a React project with a team, and two developers accidentally use the same CSS class name. Which styling approach in React ensures that there's no collision?