[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 ...
随机推荐
- 基于ANGULAR.JS的下一代WEB应用开发-01-yeoman
Angularjs 个人认为这是一款很好的框架!它将我们从AJAX应用的开发中解救了出来!嗯....废话就说道这里下面我们开始把! 首先我们必须了解一些核心的概念: 客户端模版 MVC 数据绑定 依赖 ...
- 8086汇编——Introduction(8086内部寄存器,段寄存器,存储器分段)
8086汇编--Introduction 一.8086CPU的三种工作模式 实模式:只有低20位地址线起作用,仅能寻址第一个1MB的内存空间.MS DOS运行于该模式下. 保护模式:在该模式下,机器可 ...
- [转载]iTOP-4418开发板Ubuntu系统烧写方法分享
本文转自迅为论坛:http://topeetboard.com 开发平台:iTOP-4418开发板系统:Ubuntu 1. TF卡读写速度测试烧写 Ubuntu 对于 TF 卡的要求比较高,很多老旧的 ...
- ZooKeeper系列(四)
一.配置服务 配置服务是分布式应用所需要的基本服务之一,它使集群中的机器可以共享配置信息中那些公共的部分.简单地说,ZooKeeper可以作为一个具有高可用性的配置存储器,允许分布式应用的参与者检索和 ...
- Android(java)学习笔记198:ContentProvider使用之内容观察者(观察发出去的短信)
1.新建一个案例如下: 2. 不需要添加权限,同时这里布局文件不做修改,来到MainActivity,如下: package com.itheima.sendsmslistener; import a ...
- CAD交互绘制矩形框(com接口)
主要用到函数说明: _DMxDrawX::DrawLine 绘制一个直线.详细说明如下: 参数 说明 DOUBLE dX1 直线的开始点x坐标 DOUBLE dY1 直线的开始点y坐标 DOUBLE ...
- hive纯命令行
vim /etc/profileexport HIVE_HOME=/export/servers/hive...export PATH=:$HIVE_HOME/bin:$PATH 前台启动hive:h ...
- TortoiseSVN文件夹操作
(1).安装SVN·客户端 (2) 建立库: 1.新建文件夹,目录和文件夹名称最好都用英文,不要使用中文: 2.打开文件夹,在空白处按下“shift键+鼠标右键”: 3.在弹出的菜单中选择“Torto ...
- spring封装的RabbitMQ
spring这么牛逼的团队,封装了RabbitMQ,简化了RabbitMQ的使用,那肯定是要使用spring-rabbit了 一.简介 二.使用方法 1.消费者 public class Foo { ...
- 指针函数(Pointer Function)和函数指针(Pointer to Function或Function Pointer)
一.指针函数 1.解释:指针函数很好理解:简单来说,就是一个返回指针的函数,本质是一个函数.如: int fun(int x,int y); //这是一个普通函数的声明,返回值是一个int类型, ...