Skip to content

Commit

Permalink
Update storybook.md
Browse files Browse the repository at this point in the history
  • Loading branch information
tsengyushiang authored Aug 6, 2024
1 parent 73b94ae commit 67c51e3
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions frontend/storybook.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,31 @@ const meta = {
],
}
```
### Arguments Mutation

- [reference](https://storybook.js.org/docs/writing-stories/args#setting-args-from-within-a-story)

```javascript
import { useArgs } from "@storybook/preview-api";

export const Page: Story = {
args: {
currentPage: 5,
onChange: fn(),
},
render: (args) => {
const [_, updateArgs] = useArgs();

function onChange(_: any, page: number) {
args.onChange(_, page);
updateArgs({ currentPage: page });
}

return <Pagination {...args} onChange={onChange} />;
},
};
```

## Setup Mock Service Worker

### Installation
Expand Down

0 comments on commit 67c51e3

Please sign in to comment.