Closed RubenVerborgh closed 8 years ago
@RubenVerborgh
Create a higher order render function, renderListContainer(renderItem, { ... })
But that would then contain a switch
statement or similar, right?
Would it make sense to somehow attach the render function to the state?
(I'm very new to mercury; my urge is to call item.render
with a render
defined on the prototype, but prototypes don't really apply.)
If it works then do it :D mercury has flexibility.
Fair enough 😄
Make things a bit more messy than I'd like, but manageable.
In the TodoMVC example, the app needs to know how todo items are rendered. This works in the case of TodoMVC, where all elements are uniform, but it is more complex if a list can contain items of different types.
What would be best practice to avoid the dependency of a parent on the type of its children?