-
Try to use inversion of control when a component is handling too many cases.
-
APIs are more complex when you do inversion of control, but you can replicate easily the old API using the new control inverted function
-
Some examples of inverted control functions are
Array.prototype.maporArray.prototype.filter -
Two ways of using this for components:
- Compound components (i.e.
<select><option/></select>) see this article - State Reducer: Think of a state reducer as a function which gets called any time the state of a component changes and gives the app developer a chance to modify the state change that's about to take place. see
- You can also count render props as a way of doing this but it's not recommended anymore.
- Compound components (i.e.