Featured resource
pluralsight tech forecast
2025 Tech Forecast

Which technologies will dominate in 2025? And what skills do you need to keep up?

Check it out
Hamburger Icon
  • Labs icon Lab
  • Core Tech
Labs

Build a Quiz Component with React

Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 2h 40m
Published
Clock icon Sep 12, 2022

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Creating a Quiz Component

    In this lab you’ll follow along with our instructions and build a simple quiz component with React 17.x. You’ll create several components across different files, pass data as props, and propagate events up and down a chain of components.

    In this module you'll create a Quiz component to display quiz information from state that contains data from a local JSON file. ### Solution The solution can be found in the solution directory.

  2. Challenge

    Creating a QuizQuestion Component

    In this module you'll refactor the Quiz component to display quiz question data in a new component named QuizQuestion.

  3. Challenge

    Creating a QuizQuestionButton Component

    In this module you'll refactor the QuizQuestion component to display quiz answer buttons in a new component named QuizQuestionButton.

  4. Challenge

    Creating a QuizEnd Component

    In this module you'll create a QuizEnd component that will display a reset quiz link after the quiz is completed.

  5. Challenge

    Displaying Quiz Questions and Handling Events

    In this module you'll refactor the QuizQuestion component to iterate over an array of questions and display multiple QuizQuestionButtons. Then, you'll create methods and event handlers that call them when the button tag in a QuizQuestionButton component is clicked and have those methods increment the position value in the Quiz component's state.

  6. Challenge

    Displaying An Error Message Based on State

    In this module you'll add state to the QuizQuestion class that tracks if a questions was answered incorrectly, and display an error message if the last answer was incorrect.

  7. Challenge

    Resetting the Quiz

    In this module you'll add methods and event handlers that call them when the anchor tag in the QuizEnd component is clicked, and have those methods reset the position value in the Quiz component's state.

Jon is an author, developer, and Pluralsight team member via Code School. Lately, he's been working on content and products that help authors create content efficiently. Prior to that, he worked for several years on interactive learning at Code School, and later helped bring that to Pluralsight as Interactive Content.

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.