|
|
|
|
|
by shhsshs
2344 days ago
|
|
What is the benefit of a request mocking framework versus hiding all api requests behind a module? Instead of // MyComponent.js
const users = await fetch(...
Use this // MyComponent.js
const users = await api.getUsers()
// api.js
export default {
getUsers() {
return fetch(...
}
}
To mock, you replace the entire api module (or individual functions). |
|
I am sure that you can do all without Mirage and I am sure that your solution might fit your project best, but I doubt that it will take you the same amount of effort
(I have been using Mirage for the past 4 years and I love it)