DEV Community

Clarice Bouwer
Clarice Bouwer

Posted on • Edited on

4 2

Use React hooks inside an MDX story in Storybook

<Story name="With hooks">
  {() => {
    const [count, setCount] = useState(0);
    return (
      <button
        onClick={() => setCount(count + 1)}
      >
        Clicked {count} time(s)
      </button>
    );
  }}
</Story>
Enter fullscreen mode Exit fullscreen mode

Top comments (2)

Collapse
 
andrerpena profile image
André Pena • Edited

I wish there were more articles like this that just cut all the fluff

Collapse
 
lmnt profile image
lmnt-dev

Fucking legend.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more