Skip to content

Commit

Permalink
📝 Update developer docs about mocking in stories
Browse files Browse the repository at this point in the history
  • Loading branch information
sergei-maertens committed Oct 24, 2024
1 parent cc89642 commit e462d11
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/developer-docs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ There are some known limitations related to mocking, with possible workarounds d

There is no dedicated add-on panel to manage mock responses. Instead, you can rely on story args to
dynamically change response data. To achieve this, you need to configure the worker as part of the
story template, for example:
story render function, for example:

```jsx
import {getWorker} from 'msw-storybook-addon';
Expand All @@ -201,9 +201,9 @@ import {myMockFactory} from './mocks';

export const worker = getWorker();

export const Template = args => {
worker.use(myMockFactory(args.someArg));
return <MyComponent />;
const render = ({someMockArg, ...args}) => {
worker.use(myMockFactory(someMockArg));
return <MyComponent {...args} />;
};
```

Expand Down

0 comments on commit e462d11

Please sign in to comment.