Getting unanswered questions from the REST API

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:

  1. 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 ...

Get ASP.NET Core 3 and React now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.