Creating Mock Data
Learn to create mock data for our frontend.
We'll cover the following...
We desperately need some data so that we can develop our frontend. In this section, we’ll create some mock data in our frontend. We will also create a function that components will call to get data. Eventually, this function will call our real ASP.NET Core backend.
Steps to create mock data
Follow these steps:
Create a new file in the
src
folder calledQuestionsData.ts
with the following interface:
Press + to interact
export interface QuestionData {questionId: number;title: string;content: string;userName: string;created: Date;}
Before moving on, let’s understand the code we have just entered since we have just written some TypeScript.
Note: An interface is a type that defines the structure for an object, including all its properties and methods. ...