Lesson
Set Up Mock Service Worker in the Browser
- Access
- Included
- Transcript
- Needs source
Set up Mock Service Worker in the browser, (1) generate a worker script via the npx msw init command; (2) create mocks/borwser.ts and use setupWorker() to create a worker instance; (3) defer your application's rendering in entry.client.tsx by introducing an enableMocking() function that calls await worker.start().