Optimizing your experience
storybook.js.orgstorybook.js.org
Gradient background

Use React hooks inside an MDX story in Storybook

Clarice Bouwer

Software Engineering Team Lead and Director of Cloudsure

Thursday, 13 January 2022 · Estimated 1 minute read
Copy
<Story name="With hooks">
  {() => {
    const [count, setCount] = useState(0);
    return (
      <button onClick={() => setCount(count + 1)}>
        Clicked {count} time(s)
      </button>
    );
  }}
</Story>