mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 06:51:46 +08:00
23 lines
554 B
Plaintext
23 lines
554 B
Plaintext
```js
|
|
// TodoItem.stories.js
|
|
|
|
import fetch from 'node-fetch';
|
|
/*
|
|
*👇 Render functions are a framework specific feature to allow you control on how the component renders.
|
|
* See https://storybook.js.org/docs/api/csf
|
|
* to learn how to use render functions.
|
|
*/
|
|
export default {
|
|
component: 'demo-todo-item',
|
|
render: (args, { loaded: { todo } }) => TodoItem({ ...args, ...todo }),
|
|
};
|
|
|
|
export const Primary = {
|
|
loaders: [
|
|
async () => ({
|
|
todo: await (await fetch('https://jsonplaceholder.typicode.com/todos/1')).json(),
|
|
}),
|
|
],
|
|
};
|
|
```
|