A storybook addon to keep state

View on Github


A storybook addon to give you access to store/retrieve arbitrary data. Similar to knobs this doesn't add any additional React wrappers to the story, so any other addons used (prop-types, jsx) aren't effected.


yarn add storybook-addon-state


import { storiesOf } from '@storybook/react';
import useState from 'storybook-addon-state';

storiesOf('FooBar', module).add('I get state', () => {
  const [count, set] = useState('clicks', 0);

  return (
      <button onClick={() => set(count + 1)}>Click Me</button>
      <div>{`I was clicked ${count} time(s)`}</div>