How do you share code between your React components without introducing more components into the hierarchy? You can't say mixins! :P
-
-
Usually to get some behavior or UI in React I make a new component and compose it w others to create stuff
@ryanflorence -
when I compose them together, they're usually in some parent/child relationship: the hierarchy. kind of like DOM
@ryanflorence -
i'm looking for a method to essentially "mix in" behavior into an existing React component class instead of composing
@ryanflorence -
Write a base class and extend it **runs away**
-
ya, that's the only way I can figure
@wycats@ryanflorence -
am I to understand that the art of subclassing is so lost that it seems like some sort of voodoo?
-
oh, it can be done. but i'd prefer composition instead of inheritance
@satya164@ryanflorence -
how about a function that takes some arguments and generates a component?
- 3 more replies
New conversation -
-
-
not adding would mean a HOC not needing to create an intermediate component to add functionality
@ryanflorence@mjackson -
for example here the HOC adds a “withShowErrorProp()” wrapper. I think reason to remove is perf related.
@ryanflorence@mjacksonpic.twitter.com/C34QhmBV7f
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.