Socket
Socket
Sign inDemoInstall

storybook-addon-state

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    storybook-addon-state

A storybook addon to keep state


Version published
Weekly downloads
15K
decreased by-5.66%
Maintainers
1
Install size
6.82 kB
Created
Weekly downloads
 

Readme

Source

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>
  );
});

FAQs

Last updated on 20 Jul 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc