5 ms·
Stateless components, or as I like to call them dumb components. We found it much easier to reason about logic in the code base with having many small dumb com
by gitgud 7y ago
Stateless components, or as I like to call them dumb components.
We found it much easier to reason about logic in the code base with having many small dumb components, which didn't have any state or complex functionality. These would be controlled by a few smart parent components to coordinate them.
The result was a lot cleaner. We implemented this on a Web client, but I think the concept would work well in any codebase.... dumb classes are easier to understand
- rumanator 7y ago> Stateless components, or as I like to call them dumb components. You mean like pure functions? https://en.m.wikipedia.org/wiki/Pure_function https://en.m.wikipedia.org/wiki/Pure_function
- gitgud 7y agoYes similar, I'm talking about reactive UI components though (used in React, Vue, Angular etc.). They're a class that might have many functions. In this case all the component's functions would be pure functions though. Perhaps a better term could be pure components maybe?
- BubRoss 7y agoWhat does that mean? Something that is read only?
- myguysi 7y agoAmen to that! I’m working my way through a React codebase that has state logic everywhere with even the most basic UI components connected to Redux. It’s so much easier to reason when they’re decoupled and you have those higher level coordinator components. Funny enough, the coordinator pattern really clicked with me when I wrote Swift apps. Similar concept. https://will.townsend.io/2016/an-ios-coordinator-pattern https://will.townsend.io/2016/an-ios-coordinator-pattern