...

/

Getting a Question from the REST API

Getting a Question from the REST API

Learn to interact with REST API to perform multiple tasks.

We are going to refactor our existing getQuestion function to use our http function to get a single question from our REST API.

Implementing HTTP Request in QuestionsData.ts

Carry out the following steps in QuestionsData.ts:

  1. We'll start by clearing out the current implementation, like so:

Press + to interact
export const getQuestion = async (
questionId: number,
): Promise<QuestionData | null> => {
};
  1. Let's make the HTTP request to get the question: