reactjsreact-styleguidist

Dynamic examples in react-styleguidist


all.

I just started using react-styleguidist and am loving the ease of use. However, I would like to add dynamic examples to the documentation. i.e. examples that a viewer of the docs can interact with by changing the props via buttons, events, and other async interactions.

Right now i can only seem to generate doc examples like this in markdown

js <MyComponent propOne="something static" />

Is there away around this, I would like to be able to document and develop at the same time and not have to also use react-storybook.

Thanks,


Solution

  • Answer from Styleguidist docs:

    Each example has its own state that you can access as state variable and change with setState() function. Default state is {} and can be set with initialState.