December 2019
Intermediate to advanced
598 pages
12h 21m
English
Let's carry out some more steps to implement the question page a little more:
export const getQuestion = async ( questionId: number): Promise<QuestionData | null> => { await wait(500); const results = questions.filter(q => q.questionId === questionId); return results.length === 0 ? null : results[0];};
We have used the array filter method to get the question for the passed-in questionId.
import { QuestionData, getQuestion } from './QuestionsData';