Hated it every time I used it in every codebase. Dogshit APIs that suddenly change dramatically every major version
Programming
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
Also, storybook is shit. Use... that drop in replacement that's name escapes me but is 1000x better
hahaha I really want to know what you're talking about!
Ladle?
Your services, that your components, use need to be mockable. Then you can reuse your components in storyboard with mocked interactions and in your productive app with actual service interactions. That way you can also write tests for them.
Can't talk you out of it, every job that requires me to use storybook was absolute garbage. It led to code duplication, high maintenance cost, and eventually even product management agreeing to not update storybook because it slowed down development.
I worked on a team that did, and it was the second-worst application I've ever touched.
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.
Stories are like tests. You need to mock your stores if you want to isolate your stories. Just like how you mock HTTP APIs or database connections when writing tests. This is the cost of writing testable code.
I use storybook as a tool to organise and document my component library/design system (buttons, cards, typography, colours, etc) and have never had any issues. I'd stick to using it for low-level components.