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

[docs] Improve Help for People Doing a Lazy Migration for HOCs #1459

Open
1 task done
ITenthusiasm opened this issue Mar 1, 2021 · 3 comments
Open
1 task done

[docs] Improve Help for People Doing a Lazy Migration for HOCs #1459

ITenthusiasm opened this issue Mar 1, 2021 · 3 comments
Labels
docs Code is fine, documentation is not.

Comments

@ITenthusiasm
Copy link
Member

ITenthusiasm commented Mar 1, 2021

The Problem

From what I've seen in the docs, there doesn't seem to be much straightforward assistance for those upgrading React JSS when it comes to HOCs. Some useful links are posted, but it would be helpful if the user didn't have to learn/read up on all the topics on their own.

The Solution

Instead of redirecting the user to other articles, the docs could provide an example of creating a custom HOC in JS/TS that implements the new hooks API (in addition to providing links for those interested in learning more).

Some Thoughts/Concerns

  1. If a HOC example was provided that used hooks, it may not be easy to provide a [simple] example that's compatible with decorators. (If decorators aren't a focus/concern, then this isn't a problem.)
  2. I wasn't sure if an example solution was excluded to avoid being opinionated. Thoughts or clarity on this would be helpful.

  • I am willing to implement this
@kof
Copy link
Member

kof commented Mar 1, 2021

If I understand correctly you are looking for an example how to create a HOC using the hook as a goal to keep using the existing components using HOC, right?

I think it's a great idea and we should add this when we decide to remove the HOC. Right now the message is to stop using them and use hooks interface.

You or anyone else are welcome to add such an example to the docs!

@kof kof added the docs Code is fine, documentation is not. label Mar 1, 2021
@ITenthusiasm
Copy link
Member Author

Yes, you are correct!

You or anyone else are welcome to add such an example to the docs!

I'll try to look into this some time this weekend or next. I think the example shouldn't be too hard to create. Feel free to ping me again if I vanish after the next 2 weeks.

@ITenthusiasm
Copy link
Member Author

I'll try to look into this some time this weekend or next. I think the example shouldn't be too hard to create. Feel free to ping me again if I vanish after the next 2 weeks.

Literally 3 weeks ago. But other things have left me preoccupied, obviously. With #1460 out of the way, and with the confusion of #1469 resolved, I'm going to start working on a draft for this. Hopefully it should be a pretty small change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Code is fine, documentation is not.
Projects
None yet
Development

No branches or pull requests

2 participants