[GraphQL] Query Local and Remote Data in Apollo Link State
In this lesson, you will learn how to query local and remote data in Apollo Link State in the same component.
We'll set the @client decorator on the local client State variable and set an empty Query object to get this done.
Query cache data:
TO query caches data, only need to add '@client':
const getCountQuery = gql`
{
count @client
pokemon(name: "Pikachu") {
image
}
}
`;
Set up default data for the client:
const client = new ApolloClient({
uri: "https://graphql-pokemon.now.sh",
clientState: {
defaults: {
count: 0
},
resolvers: {
Query: {}
}
}
});
Read More: https://www.apollographql.com/docs/react/essentials/local-state.html
[GraphQL] Query Local and Remote Data in Apollo Link State的更多相关文章
- 爬取LeetCode题目——如何发送GraphQL Query获取数据
前言 GraphQL 是一种用于 API 的查询语言,是由 Facebook 开源的一种用于提供数据查询服务的抽象框架.在服务端 API 开发中,很多时候定义一个接口返回的数据相对固定,因此要获得 ...
- Knockout Grid - Loading Remote Data
http://wijmo.com/grid-with-knockout-viewmodel-loading-remote-data/ We were hearing quite a few peopl ...
- fastboot 刷system.img 提示 sending 'system' (*KB)... FAILED (remote: data too large)
华为G6-C00卡刷提示OEMSBL错误,只能线刷 ,但是官方找不到线刷img镜像,无奈 网上下了个可以线刷的工具套件 流氓ROM . 使用HuaweiUpdateExtractor(工具百度)把官方 ...
- The ‘Microsoft.ACE.OLEDB.12.0′ provider is not registered on the local machine. (System.Data)
When you try to import Excel 2007 or later “.xlsx” files into an SQL Server 2008 database you may ge ...
- Microsoft SQL Server 17导出xlsx文件时报错:The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine. (System.Data)
导出数据时报错: 如果你是导出office 2007格式 TITLE: SQL Server Import and Export Wizard ---------------------------- ...
- 【转】 Pro Android学习笔记(七六):服务(1):local和remote
文章转载只能用于非商业性质,且不能带有虚拟货币.积分.注册等附加条件.转载须注明出处:http://blog.csdn.net/flowingflying/ Android提供服务,服务是运行在后台的 ...
- [Vue-rx] Cache Remote Data Requests with RxJS and Vue.js
A Promise invokes a function which stores a value that will be passed to a callback. So when you wra ...
- [Node.js] Proxy Requests for Local and Remote Service Parity
High availability apps require that no distinction be made between local and remote services. Attach ...
- @Query Annotation in Spring Data JPA--转
原文地址:http://javabeat.net/spring-data-jpa-query/ In my previous post on Spring Data, I have explained ...
随机推荐
- 字符串(String)几个常用方法的详解
String:(字符串) indexOf() 方法可返回某个指定的字符串值在字符串中首次出现的位置. stringObject.indexOf(searchvalue,fromindex) searc ...
- powerdesigner连接MySQL数据库时出现Non SQL Error : Could not load class com.mysql.jdbc.Driver
Non SQL Error : Could not load class com.mysql.jdbc.Driver 这是因为powerdesigner 无法找到驱动所产生的 解决办法是:配置系统的c ...
- 【转】C# 二进制,十进制,十六进制 互转
//十进制转二进制 Console.WriteLine(Convert.ToString(69, 2)); //十进制转八进制 Console.WriteLine(Convert.ToString(6 ...
- docker数据卷的管理和使用
数据卷的使用,数据库可以保证如果容器出现问题但是数据不丢失的作用,比如MySQL/date下的数据 或者Nginx根目录下的index.html 查看数据卷 [root@docker ~]# dock ...
- 第3节 mapreduce高级:2、3、课程大纲&共同好友求取步骤一、二
第五天课程大纲:1.社交粉丝的数据分析:求共同好友2.倒排索引的建立3.自定义inputFormat合并小文件 4.自定义outputformat5.分组求topN6.MapReduce的其他补充 了 ...
- javascript事件委托和jquery事件委托
元旦过后,新年第一篇. 初衷:很多的面试都会涉及到事件委托,前前后后也看过好多博文,写的都很不错,写的各有千秋,自己思前想后,为了以后自己的查看,也同时为现在找工作的前端小伙伴提供一个看似更全方位的解 ...
- Node.js中的Buffer
Buffer介绍 为什么要用Buffer? 在Node/ES6 出现之前,前端工程师只需要进行一些简单的额字符串或者ODM操作就可以满足业务需求了,所有对二进制数据比较陌生. 在node出现之后,前端 ...
- Far Relative’s Problem (贪心 计算来的最多客人)
Description Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n ...
- ROS 笔记 程序包/节点/topic
官方教程: wiki.ros.org/cn/ROS/tutorials 程序包打创建于编译 创建程序包 在工作空间的src底下,输入如下命令: $ catkin_create_pkg 要创建的包名 依 ...
- JQuery_九大选择器
JQuery_九大选择器-----https://blog.csdn.net/pseudonym_/article/details/76093261