We are going to start interacting with the REST API on the home page when displaying the list of unanswered questions. The HomePage component won't actually change, but the getUnansweredQuestions function in QuestionsData.ts will. In getUnansweredQuestions, we'll leverage the native browser fetch function to interact with our REST API. If you haven't already, let's open Visual Studio Code and carry out the following steps:
- Open QuestionsData.ts, find the getUnansweredQuestions function, and replace the implementation with the following content:
export const getUnansweredQuestions = async (): Promise<QuestionData[]> => { let unansweredQuestions: QuestionData[] = []; // TODO - call api/questions/unanswered ...