Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can you elaborate the design of "Adapter"? #14

Closed
unixzii opened this issue Mar 5, 2019 · 2 comments
Closed

Can you elaborate the design of "Adapter"? #14

unixzii opened this issue Mar 5, 2019 · 2 comments

Comments

@unixzii
Copy link

unixzii commented Mar 5, 2019

As far as I learn from the sample, the adapter is an abstract that provides a subtree of the full state for a specific item (which is controlled by a so-called "Component") in list views. Is my understanding correct?

Why can't we just extract the data of one item and pass it to the view, since we can put the logic (reducers & effects) into the containing component? Is that kind of consideration for Divide and Conquer?

@zjuwjf
Copy link
Contributor

zjuwjf commented Mar 5, 2019

Adapter is a better "Component" in ListView.

A ListView could be built by a main adapter which combines many small adapters.
It's similar with a flat-map operator.

  1. It solves the big cell issue .
  2. It provides two more events, appear & disappear .
  3. Adapter's effect part has the same lifecycle as the ListView, whether the view part is visible or not in the ListView.

The example only demonstrated how to use an adapter but didn't show the advantages.

@unixzii
Copy link
Author

unixzii commented Mar 5, 2019

Now I think I got the point, and the flat-map fashion transformation is also an important thing, cool!

But there are still many concepts (like connector, dependent) that need time understanding, it would be better if there would be some detailed documentation in the future.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants