anyone have experience using this library with cljs?
thinking about using it so I can get away from the function as a child pattern in my Apollo components
it also seems to have some other solid benefits like smaller bundle size, auto refreshing cache on component mount
@lilactown I saw you mentioned using apollo-client
directly instead of react-apollo
. how has that been?
For cljs, especially if you use re-frame, but also if not, https://github.com/oliyh/re-graph works very nice.
I did try out re-graph, one thing I struggled with was how I should use the result of a query to render a component, since it fires a callback instead of returning a value.
I’m coming from js where I would do something like const CarList = () => <Query>{ ({data}) => <list>{data.cars}</list> }</Query>
I’m using hooks for state instead of re-frames app-db
and writing out the fn as a child pattern in cljs is a pain. It would be nice to be able to do
(defnc my-component [] (let [{:keys [data error loading]} (use-query my-query)][:list …]))
@stefan.age if you're using hx, I would try react-apollo first
I think there's a hook version maybe?
Yeah there’s react-apollo-hooks
Just thought graphql-react
looked interesting as well
But then realized maybe I can get away from fn as a child components with apollo-client
you could, but you would have to build the hooks yourself
ah ok
for reagent, we built a wrapper that takes the apollo-client observable and wraps it in a reagent atom
it works well now but it was some work and ongoing maintenance
graphql-react does look pretty nice w.r.t. bundle size
the other thing I appreciate about apollo is the devtools. but YMMV
yeah I think I’m leaning toward react-apollo-hooks
with react-apollo
since I’m pretty familiar with apollo already