From the course: Master React 19 and Next.js 16 with Hands-On Projects and Real-World Applications

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

QuestionView: QuestionHeader

QuestionView: QuestionHeader

In this session, we're going to break down how data flows into the Question View component and gets passed along to each of its children. This is the data we have available. We have the Questions array. This stores all questions. We have the state object store the index of the current question, answers, and so on. To get a question, we will use the question index taken from the state. This is how each question object looks like. Understanding the data will make building the Question View component really easy. Let's start with Question Header. The current question number comes from state dot current question plus one. The number of questions is the length of the questions array. Time left comes from state dot time left. This will be formatted using a util function we will build later. The question text comes from the question property of the current question object. Answer options come from the options property of the current question object. The image or video path comes from the…

Contents