December 2019
Intermediate to advanced
598 pages
12h 21m
English
The time has come to implement state in the HomePage component so that we can store any unanswered questions. But how do we do this in function-based components? Well, the answer is to use another React hook called useState. Follow the steps listed in HomePage.tsx to do this:
import { useEffect, useState } from 'react';...import { getUnansweredQuestions, QuestionData } from './QuestionsData';
const [questions, setQuestions] = useState<QuestionData[] | null>(null);useEffect(() ...