storybook/docs/snippets/angular/loader-story.mdx.mdx
2021-07-02 21:29:08 +01:00

28 lines
491 B
Plaintext

```md
<!-- TodoItem.stories.mdx -->
import { Meta, Story } from '@storybook/addon-docs/blocks';
import TodoItem from './TodoItem';
import fetch from 'node-fetch';
<Meta title="Examples/Loader" component={TodoItem} />
<Story
name="Primary"
loaders={[
async () => ({
todo: await (
await fetch("https://jsonplaceholder.typicode.com/todos/1")
).json(),
}),
]}
>
{(args, { loaded: { todo } }) => ({
props: {
todo: todo,
},
})}
</Story>
```