How to use the @storybook/client-api.useAddonState function in @storybook/client-api

To help you get started, we’ve selected a few @storybook/client-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github storybookjs / storybook / examples / dev-kits / stories / addon-useaddonstate.tsx View on Github external
export const managerDefault = () => {
  const [state, setState] = useAddonState('manager');

  return (
    <div>
      Manager counter: {state}
      <br>
      <button> setState(state - 1)}&gt;decrement</button>
      <button> setState(state + 1)}&gt;increment</button>
    </div>
  );
};
github storybookjs / storybook / examples / dev-kits / stories / addon-useaddonstate.tsx View on Github external
export const previewDefault = () =&gt; {
  const [state, setState] = useAddonState('preview', 50);

  return (
    <div>
      Manager counter: {state}
      <br>
      <button> setState(state - 1)}&gt;decrement</button>
      <button> setState(state + 1)}&gt;increment</button>
    </div>
  );
};