How can we attribute loaders rsult to a specific arg #15387
Unanswered
BennaceurHichem
asked this question in
Help
Replies: 1 comment
-
Loaders are an experimental feature and they are not yet part of the typescript interface. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using a loader in a component story, and the data is correctly fetched, the documentation said that the result of the lozder is accessible from
loaded
object. I tried to pass theloaded.property
into an arg but an error is shownCannot find name loaded
which is a typescript error, the data of loaded still not used, and I'm confused on how can I access to the storybook context to see that content ofloaded
to name the debugging easierthis is my story and loaders where loaded is cannot found :
export const Loading = Template.bind({}); (Loading as any).args = { options:loaded.options, //other properties };
Loading.loaders = [ async () => ({ options: (await fetch('https://jsonplaceholder.typicode.com/albums')).json(), }), ];
I want to test the loading of a component with async request, to reflect the loading state, then the reflect the state of the component when data is fully loaded, if I'm wrong in my approach please let me know.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions