Based on his Career-o-meter, @williamheslam explains:
PT1. "Each of the four child components has internal state, which makes them hard to test."
Can we avoid this?
"We could consolidate all the state into a 'smart' parent component, making the children all pure components"...
PT 2.
OR... Dependency injection!
Pros:
-Pure, avoids mutating global dependencies
-Explicit, makes it clear what a component does or does not use
Cons:
- Unwieldy when composing components...
#React #JavaScript #testing
Dec 8, 2020 · 6:18 PM UTC



