Feedback: Browser integration #387
-
FeedbackI want to know how to integrate msw with a react app? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Sharing my original response on Discord below. Hi!
You don't run servers with MSW. It either works in the browser alongside your app (https://mswjs.io/docs/integrations/browser), or in your server's process (https://mswjs.io/docs/integrations/node). Pick one or choose both at the same time.
Here's an example that is using React: There's really nothing specific you should know in order to integrate MSW into a React project. The integration is almost the same in any framework, and the only thing that changes is where your framework exposes those entrypoints for the client and the server. |
Beta Was this translation helpful? Give feedback.
Sharing my original response on Discord below.
Hi!
First things first,
You don't run servers with MSW. It either works in the browser alongside your app (https://mswjs.io/docs/integrations/browser), or in your server's process (https://mswjs.io/docs/integrations/node). Pick one or choose both at the same time.
Here's an example that is using React:
https://github.com/mswjs/examples/tree/main/examples/with-remix
There's really nothing specific you should know in order to integrate MSW into a React project. The integration is almost the same in any framework, and the only thing that c…