Building a Mock API in React
Вставка
- Опубліковано 7 бер 2024
- 🚀 Project React → cosden.solutions/project-react
Join The Discord! → discord.cosdensolutions.io
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!!!
Really excited for your project react course🔥
Great initiative waiting for this😊
Lolz from the guy who learned the hard way, this is pretty cool.
This is smart, becuase I usually get dropped into projects where someone else is setting up the API or dealing with data warehouse.
That's exactly the goal! To simulate a real-world project
Awesome thank you bro
In this course add redux also ,it helps both ways hooks and redux concepts ,add many filters and check boxes to help further.
Yep, there's redux in there!
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.
this is for learning purposes only
Covering just basics are all the advanced topics in your roadmap ? will you cover react query (please do )
React Query is in part 2 which is coming a little later!
cool best of luck waiting for the course desperately, some PPP for india and student discount would be graceful @@cosdensolutions
Hi Cosden good work!
Sorry but i think that you can avoid all this work, with the json-server package, right ?
Absolutely
Yeah you could, but you'd still have to implement auth yourself. Also, I wanted to show how an API backend would look like for those who want to learn in a safe and easy way
can you tell me if there are any fetch request in the network tab? i didn't get it
there aren't any, it's all mocked!
Will you be using ts?
Not for this one. Wanted to make it accessible to everyone
when is it comping, ?
Less than 2 weeks!
Any Next.js course?
How much is this course?
Details are coming very soon!
msw is better
Produces the same result tbh, you won't directly touch this anws but its there for the curious ☺️