- parent has multiple items and able to sent call back to parent
- Parent should be able to accept any type of component
https://jsbin.com/xamoyuxabi/3/edit?js,output
- get children and map it as children may have array (which may break)
- accordion is tightly couple with renderItem making it almost impossible to reuse
- pretty hard to communicate with parent ie sending call back
https://jsbin.com/xamoyuxabi/5/edit?js,output
https://jsbin.com/kuriyol/3/edit?js,output
with render props
is pretty hard to understand and code is not dry or reusable as well as its tightly coupled component which makes its hard to reuse with different type of child.
either HOC
or create element
makes sense as its easy to understand and refactor.
/HOC may be harder to understand at first/