Skip to main content

Mocking data

This template uses MSW to mock data.

Mocks are automatically generated with orval script - you can check docs here

Enabling mocks

You have two types of enabling mocks in the app

  1. Start server and set mock on start
IS_MOCK=true yarn start
  1. Enable mock manually

Go to App.tsx and change ENABLE_MOCKED_SERVER variable from false to true

/App.tsx
// FIXME: moking not working on mobile app - follow this discussion https://github.com/mswjs/msw/issues/2026
const ENABLE_MOCKED_SERVER = isMock
const ENABLE_MOCKED_SERVER = true

if (ENABLE_MOCKED_SERVER) {
startMockedServer()
}

This will start msw server and api calls will be mocked!