Reusing a list container component with different cell #1837
Unanswered
superx3man
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Hi @superx3man, I haven't personally used this pattern, but just wanted to say that nothing immediately stands out as problematic about it. I'd be curious to see an example of what it looks like at the call site when you construct the parent domain, both reducer and view. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In my project, there's a list component that I'd like to reuse for another screen, but it has a different cell design and functionality.
My first thought was wrapping the different types of cells in an enum-driven ReducerProtocol.
Though this would require the module that hosts
MyList
to have knowledge of every variation of cells. In a modularized codebase, the list module would need to have dependencies on all cells' modules.After playing around with generics, I have this pattern prototyped.
The above wrapper call takes in a
ReducerProtocol
with a bit of extra information and could work with a flexible type.The advantage is now I could have cell designs in different modules and these modules would have a dependency on the list module. (Instead of the reverse)
I haven't dug too much into this pattern and wonder if anyone has tried it before. Not sure this would cause problems down the road when I expand on it.
Beta Was this translation helpful? Give feedback.
All reactions