In this basic tutorial we are going to add Mock Service Worker to an existing Create React App application. You can follow the same steps from this tutorial to integrate MSW into your application regardless of the setup you have.
Let's start by installing the
msw package into our project.
Run the following command in your project's root directory:
1npm install msw --save-dev2# or3yarn add msw --dev
With the library installed, let's continue with defining which requests to mock.