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

migrating away from deprecated HOC #9654

Closed
petyavok opened this issue May 2, 2022 · 6 comments
Closed

migrating away from deprecated HOC #9654

petyavok opened this issue May 2, 2022 · 6 comments

Comments

@petyavok
Copy link

petyavok commented May 2, 2022

Hi,

What is the best way to migrate away from the deprecated hocs in apollo client?

https://www.apollographql.com/docs/react/api/react/hoc/

It would be extremely difficult for us to use hooks, since all of our components are built on recompose and class based components, which would need a complete rewrite.

Do any of you know a still maintained drop-in replacement with zero or minimal changes required, for the graphql() hoc?

We also evaluated creating our own hoc implementation based on the deprecated one, but it doesn’t seem like an easy solution, if we want to cover all the features it has.

If anyone has a suggestion, or was in the same situation please let me know, thanks.

@isnifer
Copy link

isnifer commented May 2, 2022

@petyavok

export const withHooksHOC = (Component: any) => {
  return (props: any) => {
    const screenWidth = useScreenWidth();

    return <YourClassBasedComponent width={screenWidth} {...props} />;
  };
};

@jpvajda
Copy link
Contributor

jpvajda commented Jun 3, 2022

@petyavok Thanks for the question. You can try posting this in our Apollo Community for guidance from other Apollo users, as other's may have input into your question.

I'll leave this open an issue as well, in case others have ideas.

@alessbell
Copy link
Contributor

Hi @petyavok 👋

I'm doing a bit of housekeeping and came across this issue. I don't have any advice to add here, but I wanted to give you a heads up that the deprecated HOC APIs (deprecated since 2020) will be indicated as deprecated in 3.9 onward in their respective docblocks, so you will see that in your IDE if using TypeScript.

I'm going to go ahead and close this issue, but please feel free to ask any usage-related questions like this in our Discord going forward. Thanks.

Copy link
Contributor

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better.

@alessbell alessbell closed this as not planned Won't fix, can't repro, duplicate, stale Jan 29, 2024
Copy link
Contributor

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better.

Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
For general questions, we recommend using StackOverflow or our discord server.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants