apollo-feature-requests icon indicating copy to clipboard operation
apollo-feature-requests copied to clipboard

Better support for Preact and Apollo Client

Open jpvajda opened this issue 3 years ago • 1 comments

Reading the Preact docs there seems to be a lot of compatibility with React, so it sounds like you could use Apollo Client with this view library. We suspect the React bindings might not work quite right in Preact. Apollo hooks depends on primitive hooks from the React package.

Furthermore, it looks like Preact has a lot of similar hooks (for example useContext), but these would need to be imported from preact, not from react. That being said, the core should work (i.e. ApolloClient ) since it is framework agnostic. Its really just the preact bindings that would need to be added between the client and preact itself.

This issue is to measure interest in Preact with Apollo Client, and also have a place for people to report problems they might be coming across when using this view library with Apollo Client.

Some History

We used to officially support Preact with Apollo Client 2, to the point of it being allowed as a drop in replacement for React, and then automatically used with our render prop based Components. We ended up removing support (see this commit) because 1) Preact was falling behind React and was different enough that supporting it alongside React was a maintenance challenge, and 2) at the time there wasn't a lot of interest from the community to use Apollo Client with Preact.

jpvajda avatar Oct 10 '22 18:10 jpvajda

I also couldn’t find any 3rd party libraries supporting Preact and Apollo Client, but these 1 & 2 seemed to make an attempt. However it doesn't seem there is much activity on these repos.

jpvajda avatar Oct 10 '22 19:10 jpvajda

@jpvajda really appreciate the thought here!

I'm not sure this is something we want to focus on in the near future. Seeing how this issue hasn't been "upvoted" since its been opened, I'm inclined to say that either Preact + Apollo aren't heavily used together, or the existing React solution works well enough.

For now I'm going to go ahead and close this issue. I'd be happy to open again if discussions heat up on this topic. Thanks!

jerelmiller avatar Apr 06 '23 02:04 jerelmiller