Lab 4
Lab 4
Building a ReactJS application with a user interface that requires the user to input a list of questions and
answer options for each question. Display the questions and answer options to the user and check
whether the user has selected the correct or incorrect answer.
Continue using the same user interface as in Lab 3. However, apply it using Hooks.
Import React and the necessary Hooks from the 'react' package.
Create the Quiz component and set up the initial state using the useState Hook.
Define the quiz questions and answer options as an array of objects.
Use the useState Hook to manage the user's input for each question and answer option.
Create input fields or components for the user to enter the questions and answer options.
Update the state with the user's input using the useState Hook.
Use the useEffect Hook to display the questions and answer options from the state.
Render the questions and answer options in the UI using JSX.
Use the useContext Hook to access the selected answer from the state.
Compare the selected answer with the correct answer for each question.
Display whether the selected answer is correct or incorrect in the UI
Page 1
Page 2