Component driven development VS colocation #33293
Replies: 1 comment
-
|
Hi @Fawwaz-2009! I'm Dosu and I’m helping the storybook team. Great question—this is a common tension in modern frontend architecture. Here’s what’s working well for teams using Storybook with component-driven development and colocation:
You can try these patterns to balance colocation and testability. If you run into specific issues with tRPC or syncing mocks, sharing a minimal reproduction or more details will help with targeted advice. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Hey all 👋 I'm trying to find experts in components driven development and pick their brain on some doubts I'm having.
A big trend in the industry that I'm very thankful for is co-location, including co-location of APIs for both query and actions. This is great because it creates self-isolated components that compose Incredibly well.
However, from my research about component driven development, it seems to handle external dependency or frameworks dependencies, you end up with two options.
Option one, make all storybook components basically presentational and their contract specified in their in their props. However, this breaks the idea of co-location APIs and actions. You can see the below example of a storybook component I created during my exploration and honestly feels wrong and I feel I'm going back in time to a period I didin't like
The second option is around mocking APIs. But I'm not sure how painful would that option be because it's not clear to me if this is going to be an initial setup cost and afterwards the cost will be low or if this is going to be an ongoing large cost to sync the mocked APIs with the actual APIs that they're using and TRPC quirks, etcetera.
What do you all think and would be grateful for any insight that you can add?
Additional information
No response
Create a reproduction
No response
Beta Was this translation helpful? Give feedback.
All reactions