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

Make Use of Composition #3268

Closed
5 tasks done
alitaheri opened this issue Feb 9, 2016 · 5 comments
Closed
5 tasks done

Make Use of Composition #3268

alitaheri opened this issue Feb 9, 2016 · 5 comments
Labels
umbrella For grouping multiple issues to provide a holistic view

Comments

@alitaheri
Copy link
Member

We need to improve the way our components work. and the best way is to externalize the concerns instead of doing everything ourselves.

The Problems:

  1. Imperative methods (we can't fix focus)
  2. Pure rendering
  3. ref
  4. Style memoization
  5. Getting theme from context or the default theme

The blessed solutions 👼 👼

  • 1. Warpgate! I'm working on this one. A component that can warp imperative method calls down the tree. After giving it a lot of thought, I have finally found the solution and I'm working on it.
  • 2. Recompose has already solved this
  • 3. Also Recompose, see here 😆
  • 4. I already solved it with react-memo, see the demo [Discussion] Utilize react-memo #3248
  • 5. @newoga Took care of this a long time ago in a galaxy far away 😄

The Chain:

We have those, good how do we line them up?

I have this in mind:

Components with imperative methods:

--> o------o------o------o------o------o--> TargetComponent
    ^      ^      ^      ^      ^      ^
    |    theme    |     pure    |      |
    |            etc         memoize   |
    |                                  |
warpgate yin ------------------> warpgate yang

Components without imperative methods:

--> o------o------o------o------o--> TargetComponent
    ^      ^      ^      ^      ^
    |    theme    |     pure    |
 toClass         etc          memoize

Since warpgate will have to be refable itself it won't need toClass.

The dreaded ping 😆 @newoga @oliviertassinari @mbrookes

@alitaheri alitaheri added Core umbrella For grouping multiple issues to provide a holistic view labels Feb 9, 2016
@oliviertassinari
Copy link
Member

@alitaheri The order of HOC looks good 😍!

@alitaheri
Copy link
Member Author

Thanks 😁

What do you think about the warpgate? do you think it overcomplicates? I didn't see any other solution -_-

@newoga
Copy link
Contributor

newoga commented Feb 9, 2016

and the best way is to externalize the concerns instead of doing everything ourselves.

Truth!

This issue makes me very happy, I think we're definitely heading in the right direction. I'd be very curious to see a branch where we can migrate a few of our bigger components end to end with this HOC chain.

Sounds good @alitaheri!

@alitaheri
Copy link
Member Author

Thanks 😁 I'll go on and work on the warpgate. after it's done and all works as expected I'll write tests and documentations for both the warpgate and the memo. Then we can migrate the entire code base and live a happier life 😆

However, before complete migration I plan on breaking some parts of the code so we can implement these easier. right now, some files are monstrous!

@mbrookes
Copy link
Member

This was good work, but things are changing with next. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
umbrella For grouping multiple issues to provide a holistic view
Projects
None yet
Development

No branches or pull requests

4 participants