Building a Mock API in React

preview_player
Показать описание
VSCode Theme | Font → Material Theme Darker | Menlo, Monaco "monospace"

In this video I will show you how I built a Mock API in React for my new React course, Project React. This mock API is built using axios, and functions exactly like a real API. You can fetch data, get responses, and handle loading and error states. The only difference is that the data is not coming from an endpoint, but rather from localStorage. This is a really cool way to learn how to fetch data in React without managing your own backend and database!
Рекомендации по теме
Комментарии
Автор

You’re definitely the best. Keep it up!!! Other devs don’t even talk about tests. Bravo!!!

stephanjames
Автор

Really excited for your project react course🔥

jlemuelDev
Автор

Lolz from the guy who learned the hard way, this is pretty cool.

realbigsquid
Автор

This is smart, becuase I usually get dropped into projects where someone else is setting up the API or dealing with data warehouse.

OffroadTreks
Автор

Hi, I have a question. What's the difference/best approach in doing this or simply writting our axios interceptor and based on the environment, with the help of a flag variable for example local/production, fetching real data or simple returning data from a json file?
As a fullstack sometimes I only need to work on the frontend and would like to have a mocked api server to retrieve me data and only be dependant of a frontend local server, and with hot reload see the changes immediately instead of having to package the entire application on every little change.

diniscab
Автор

In this course add redux also, it helps both ways hooks and redux concepts, add many filters and check boxes to help further.

buddytech
Автор

Hi Cosden good work!
Sorry but i think that you can avoid all this work, with the json-server package, right ?

ugogalliano
Автор

Covering just basics are all the advanced topics in your roadmap ? will you cover react query (please do )

mutasimahmed
Автор

Nice way to explain. Mocks inside the application are good for learning projects, but how do you handle live projects? Isn't keeping mocks outside the code a better approach? Like MockServer or Requestly.

coravityinfotech
Автор

can you tell me if there are any fetch request in the network tab? i didn't get it

HolySlw
welcome to shbcf.ru