@vilvaathibanpb
JavaScript / GraphQL earns my bread
Travel and painting satifies my thirst
Endless love for OSS but not committed to a single project for long 😉
Works @ Omio , A Search Engine for Travel
Co-organizer of JSRealm, Chennai (@js_realm)
@vilvaathibanpb
@vilvaathibanpb
HTTP is the most common choice for client-server protocol when using GraphQL because of its ubiquity. A GraphQL server operates on a single URL/endpoint, usually /graphql, and all GraphQL requests for a given service should be directed at this endpoint. When receiving an HTTP GET request, the GraphQL query should be specified in the "query" query string.
@vilvaathibanpb
const query = "{continents{name}}";
const graphQLClient = (query) => (
fetch(`https://countries.trevorblades.com/?query=${query}`)
.then(async (resp) =>
console.log(await resp.json()
))
)
graphQLClient(query);
@vilvaathibanpb
@vilvaathibanpb
@vilvaathibanpb
@vilvaathibanpb
@vilvaathibanpb
CACHES QUERY RESULT TREE
QUERY PATHS - SAME PATH, SAME QUERY
OBJECT IDENTIFIER
INMEMORY CACHE - WINDOW.__APOLLO_CLIENT__
@vilvaathibanpb
NETWORK INTERFACE
SHARED BETWEEN EVERY REQUEST
CUSTOM FUNCTIONALITY
COMPONSING LINK
@vilvaathibanpb
React Apollo is a React-specific abstraction over Apollo-Client. It lets you make queries/mutation in below formats:
@vilvaathibanpb
@vilvaathibanpb
QueryMethods ->
execute -> getResult -> currentResult
refreshClient startSubscribtion -> next
initializeObseQuery
getResult
useQuery -> context, options, forceupdate
-> qureyRef , queryMethods, queryData
-> result -> queryData.execute
Query -> useQuery -> children(result)
I know everyone must be tired after a long day, but I am happy to answer questions and discussions afterwards.
Please drop in some suggestions and feedback, so I can get better next time