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

Reducing adopt generated tree depth #28

Open
albertogasparin opened this issue Sep 27, 2018 · 0 comments
Open

Reducing adopt generated tree depth #28

albertogasparin opened this issue Sep 27, 2018 · 0 comments

Comments

@albertogasparin
Copy link

First thing, I really like the API of this lib, however I've noticed that for every composed component adopts adds a discrete number of intermediary components that substantially increase the React tree depth.

const Composed = adopt({
  one: ({ render }) => <One render={render} />,
  two: ({ render }) => <Two render={render} />,
});
// becomes
<Composed>
  <Adopt(one)(two)>
    <Adopt(one)>
      <Adopt>
        <one>
          <One>
            <two>
               <Two>
                 // children

This not only makes debugging the React tree harder, but if you start using it extensively to create several dozens of combined components the tree simply "explodes" and you might start having performance problems too.

It would be great if adopt could do it's magic in just one layer:

<Composed>
  <One>
    <Two>
      // children
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

1 participant