Set up your local environment for projects. We'll walk you through everything you need to know, including how to install and configure your environment to be able to complete all of the tasks.
Creating a Quiz Component
Create a Quiz component to display quiz information from state that contains data from a local JSON file.
Creating a QuizQuestion Component
Refactor the Quiz component to display quiz question data in a new component named QuizQuestion.
Creating a QuizQuestionButton Component
Refactor the QuizQuestion component to display quiz answer buttons in a new component named QuizQuestionButton.
Creating a QuizEnd Component
Create a QuizEnd component that will display a reset quiz link after the quiz is completed.
Displaying Quiz Questions and Handling Events
Refactor the QuizQuestion component to iterate over an array of questions and display multiple QuizQuestionButtons. Then, 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.
Displaying An Error Message Based on State
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.
Resetting the Quiz
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.
In this project you’ll follow along with our instructions and build a simple quiz component with React 16.x. You’ll create several components across different files, pass data as props, and propagate events up and down a chain of components.
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.