0 2 min 8 mths

Today we will learn how to fetch data using create own JSON server, firstly we need to create React app using

this cmnd on command prompt =>create-react-app<your-projectname>

for the start you app using the command is=> npm start

once you have to do then you have directory structure like

now you go the jsonplaceholder website to create json data. create new file name db.json on your root directory.

{    “customer”:paste your selected json data from jsonplaceholder

}

show as picture

then run command

yarn add json-server

yarn add concurrently

add object on scripts

    “json-server”: “json-server –watch db.json –port 3005”,

    “start:dev”: “concurrently \”npm start\” \”npm run json-server\””,

yarn add axios

for using bootstrap class you need to import the bootstrap command

yarn add bootstrap

create new file like Home.js

add syntax or react js

add all code on you file then run the command npm run start:dev

then show output like be this img

Leave a Reply

Your email address will not be published. Required fields are marked *