How to use the @storybook/client-api.useState 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 JetBrains / ring-ui / components / dialog / dialog.examples.js View on Github external
export const withOverflowScrollOnHtml = () => {
  const [open, setOpen] = useState(false);

  return (
    <div>
      <div>Scroll down</div>
      <button> setOpen(true)}&gt;Show dialog</button>
      <dialog> setOpen(false)}&gt;
        <header>Dialog title</header>
      </dialog>
    </div>
  );
};
withOverflowScrollOnHtml.story = {
github storybookjs / storybook / examples / official-storybook / stories / hooks.stories.js View on Github external
export const Input = () =&gt; {
  const [text, setText] = useState('foo');
  return <input value="{text}"> setText(e.target.value)} /&gt;;
};
github storybookjs / storybook / examples / official-storybook / stories / hooks.stories.js View on Github external
export const Checkbox = () =&gt; {
  const [on, setOn] = useState(false);
  return (
    <label>
      <input checked="{on}" type="checkbox"> setOn(e.target.checked)} /&gt;
      On
    </label>
  );
};