svelte-gql
A lightweight and simple GraphQL client for Svelte 🔥
Definitely a WIP, but it works!
Just discovered someone already uses the name svql 😢
This started as a attempt to port the graphql-hooks library to svelte. A lot of ideas and code borrowed from that library but simplified.
Example using Sapper
<script context="module"> ; const client = ; const user = ; { return user ; }</script> <script> ; ; const user_query = /* GraphQL */ ` query { user { name } } ` user;</script> <div> #if $userfetching <div>loading...</div> /if #if $userdata #each $userdatauser as user <h1>username</h1> /each /if</div>
TODO
- Add mutations
- Add methods to clear/invalidate cache
- See if there's a way to use Svelte's context api instead of passing client instance to
query
function - Decide if I should use Graphql's Document AST and normalize data
- Since the name svql is taken, decide on another name. For now it's just svelte-gql
- Test, Test, Test