storybook-addon-state
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

storybook-addon-state

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.

Install

yarn add storybook-addon-state

Usage

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 (
    <div>
      <button onClick={() => set(count + 1)}>Click Me</button>
      <div>{`I was clicked ${count} time(s)`}</div>
    </div>
  );
});

Readme

Keywords

none

Package Sidebar

Install

npm i storybook-addon-state

Weekly Downloads

16,289

Version

1.0.3

License

MIT

Unpacked Size

5.92 kB

Total Files

10

Last publish

Collaborators

  • adierkens