File tree Expand file tree Collapse file tree
docs/docs/data-management Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ id : mocking-data
3+ slug : /mocking-data
4+ title : Mocking data
5+ sidebar_position : 5
6+ tags :
7+ - Backend
8+ - MSW
9+ - Mocking
10+ - react-query
11+ - axios
12+ - react native
13+ - orval
14+ description : Mocking - check how to mock data from backend and display it for users
15+ ---
16+
17+ # Mocking data
18+
19+ This template uses [ MSW] ( https://mswjs.io/docs ) to mock data.
20+
21+ Mocks are automatically generated with orval script - you can check [ docs here] ( /api-connection )
22+
23+ ## Enabling mocks
24+
25+ Go to ` App.tsx ` and change ` ENABLE_MOCKED_SERVER ` variable from false to true
26+
27+ ``` tsx title="/App.tsx"
28+ // FIXME: moking not working on mobile app - follow this discussion https://github.com/mswjs/msw/issues/2026
29+ // error-line
30+ const ENABLE_MOCKED_SERVER = false
31+ // success-line
32+ const ENABLE_MOCKED_SERVER = true
33+
34+ if (ENABLE_MOCKED_SERVER ) {
35+ startMockedServer ()
36+ }
37+ ```
38+
39+ This will start msw server and api calls will be mocked!
You can’t perform that action at this time.
0 commit comments