storybook/docs/snippets/svelte/loader-story.js.mdx
2021-05-06 17:36:21 +01:00

19 lines
351 B
Plaintext

```js
// TodoItem.stories.js
import fetch from 'node-fetch';
import TodoItem from './TodoItem.svelte';
export const Primary = (args, { loaded: { todo } }) => ({
Component: TodoItem,
props: {...args, ...todo},
});
Primary.loaders = [
async () => ({
todo: (await fetch('https://jsonplaceholder.typicode.com/todos/1')).json(),
}),
];
```