Recommended libraries for Vue.js + GraphQL?
Just finished my studies and thought I might pick up learning some Vue.js 2.0 and GraphQL for the winter break. Since GraphQL seems to go hand in hand with Relay and React, I was just wondering what Vue.js folks use for GraphQL?
After some quick research I found these two libraries:
https://github.com/Akryum/vue-apollo - Seems exactly what I want but from what I can tell it requires my entire stack to use their Apollo backend.
https://github.com/kadirahq/lokka - Nice client-side only library, lacking caching features but enough to get started.
My backend is a Laravel/GraphQL setup.
If anyone here has built Vue client side projects with a GraphQL API, please let us know what libraries, pitfalls and such you have encountered!
Posted Nov 24, 2016, 3:44 PM UTC · edited
I'm really surprised at the lack of information about using GraphQL with Vue.
Vue-Apollo does not require their backend. But it does have a specific way it formats the queries that I'm guessing you can handle with Laravel. I have tested it out but am looking into using something else.
I'm currently evaluating Vue Apollo and it seems pretty nice when everything is with their ecosystem. I don't think there's any cleaner alternative. Maybe not all REST folks know about GraphQL? It really is a game changer.
I spent time today playing with Apollo. The front page vue app is helpful along with the server example.
So far I think I will be using the Apollo client directly in Vuex. This seems to fit my purposes better than having Vue-Apollo do it and in the background use Redux.
The format is fairly easy to use (myQuery is in the form of a gql query). So on a component it looks like:
This also allows you to map multiple objects in that single query. I think Vue-Apollo only allows one.
I will say that the Apollo Client Vanilla JS documentation is not thorough enough and there are not many examples available.