Last active
June 16, 2019 16:46
-
-
Save aleclarson/e95cc22a52f2ec4fb5bc689a17ea6d9c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react' | |
import { UserView } from './components/user' | |
import gql from 'vana/gql' | |
// Create a data store with vana.useGraphQL | |
const data = gql.create({ | |
...options, | |
queries: { | |
users: gql`...`, | |
} | |
}) | |
// Provide your data store to descendants. | |
const App = gql(data, () => ( | |
<Child /> | |
)) | |
const Child = () => { | |
// The queries are observable! | |
const users = gql.useObserved(data, 'users') | |
return <> | |
{users.map(user => ( | |
<UserView key={user.id} user={user} /> | |
))} | |
</> | |
} |
Missing pieces
- No request batching
- Use HTTP/2 instead
- How are queries generated?
- How should caching work?
- How should subscriptions work?
- Local observables are updated in response to change events
- An event is sent to the client to identify what caused the change
Note to self: Figure out the new API here.
Things to consider
- https://github.com/chentsulin/awesome-graphql
- https://github.com/FlacheQL/FlacheQL (client-side caching)
- https://github.com/prisma/graphql-request
- https://github.com/timqian/gql-generator
- Be compatible with https://hasura.io
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Features