You are designing a quiz application where users can click on an option to choose their answer. To highlight the selected option and store the user's choice, you would use ________ to manage this local UI state.
- useState
- useRef
- useReducer
- useContext
To manage the local UI state in a quiz application where users can select answers, you would use the useState hook. useState allows you to create state variables that can hold the selected option and trigger UI updates when the user makes a choice. While useRef, useReducer, and useContext have their use cases, they are not the primary choice for managing local UI state in this scenario.
Loading...
Related Quiz
- You're building an e-commerce platform and need to apply different styles based on the user's selected theme. Which React library would be most suitable to dynamically style components?
- Using CSS Modules in React, class names are made locally scoped by default and transformed into a unique ______ during the build process.
- Which of the following is a benefit of using Websockets for real-time applications in React?
- What is the purpose of render method of react-dom?
- What is Redux Thunk?