#Possible to update component state and story control args?

10 messages · Page 1 of 1 (latest)

clever frigate
#

I'm wondering if it's possible to update my component state, and have that sync with my control args. That way I can type inside my form, and see the docs update with the control arg value of what is typed in the form.

plain plume
#

It is, actually! At least if you're using React, you can use the useArgs hook from @storybook/addons (or @storybook/client-api if you're on v6.x if I'm not mistaken).
I'm not sure it's doable if you're not using React though..

clever frigate
plain plume
clever frigate
#

@plain plume Interesting, so I have to do it with the client api context then.

One last question:

In Storybook 6+, we pass the args as the first argument to the story function. The second argument is the “context”, which includes story parameters, globals, argTypes, and other information.

"and other information" do you have details on what this other information is? Where in the docs could I find all the details to the second object sent to a story function?

plain plume
#

v6 or v7?

clever frigate
#

v6

plain plume
#

I actually don't know. @heavy basalt do you know if we have documentation/typings for what the story context contains?

heavy basalt