I was pretty excited to add storybook to my project, but after setting up my basic components like buttons and moving on to higher level components that render slices of state using selectors … I have regrets.

Is it me or is it really hard to ‘storybook-i-fy’ react components using selectors? I found this tutorial on the Storybook site and it looks like the preferred pattern is to duplicate your store in your storybook file? That can’t be right, can it?

Someone talk me out of taking Storybook out back and uninstalling it from my repo.

  • WhatAmLemmy@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    10 months ago

    You should only use storybook if you are going to share components across devs/projects (+ learning ofc).

    I don’t know why you’d duplicate the store. Just write centralized mock constructors once and use them for both storybook and tests. Ideally test the storybook components, so they always stay up to date with changes, but that was relatively new when I used it a couple years ago so I don’t know if they’ve ironed out the kinks yet.