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

Improving HOC section in ADVANCED cheatsheet, including forwardRef #78

Closed
OliverJAsh opened this issue Jan 21, 2019 · 6 comments · Fixed by #275
Closed

Improving HOC section in ADVANCED cheatsheet, including forwardRef #78

OliverJAsh opened this issue Jan 21, 2019 · 6 comments · Fixed by #275
Labels
wontfix This will not be worked on

Comments

@OliverJAsh
Copy link

https://gist.github.com/OliverJAsh/d2f462b03b3e6c24f5588ca7915d010e

This is quite a bit more difficult than standard forwardRef, since the component and component props are generic.

@ferdaber
Copy link
Collaborator

ferdaber commented Feb 5, 2019

Does this work using the standard InstanceType<typeof ComposedComponent>? Instead of declaring ComposedComponentInstance = Component<ComposedComponentProps>?

@OliverJAsh
Copy link
Author

@swyxio
Copy link
Collaborator

swyxio commented Feb 6, 2019

really appreciate the input, @OliverJAsh

the HOC section is a bit messy right now and i think it could be better.

by presenting so much functionality upfront we risk accidentally giving the impression that HOCs are always this complicated in typescript.

i think the better approach is to progressively build up from a "basic" HOC, then show how to deal with prop conflicts with Omit/Optionalize, then add displayName, then add ref forwarding and other stuff.

We should also try to show usage example at each step so it helps users quickly scan for the kind of HOC they need to make, and then expand to see the recommended typing strategy.

a lot of work, i know. dont have time now but i'll get to it if someone doesnt beat me to it

@swyxio swyxio changed the title forwardRef inside HOC Improving HOC section in ADVANCED cheatsheet, including forwardRef Feb 6, 2019
@swyxio swyxio pinned this issue Feb 6, 2019
@ferdaber
Copy link
Collaborator

ferdaber commented Feb 8, 2019

We may need a section just on how to write HOCs, to not completely blow up the advanced section?

@swyxio
Copy link
Collaborator

swyxio commented Feb 9, 2019

i'm open to this. either way we gotta write some stuff haha

@stale
Copy link

stale bot commented Aug 20, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions!

@stale stale bot added the wontfix This will not be worked on label Aug 20, 2020
@swyxio swyxio unpinned this issue Aug 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants