javascript - 如何在 React Native 中将查询变量传递给我的查询?
问题描述
我正在尝试从 GraphCMS 获取有关我的 API 的信息,但我不确定如何实现这一点。
我还没有尝试过任何事情,因为我不确定如何在我的 React 应用程序的查询中添加一个变量。
const NewsQuery = gql'
query contentView_b0488406c55f4bf5a28ceb86138c948c($first: Int, $skip: Int, $where: PostWhereInput, $orderBy: PostOrderByInput) {
contentView_content_b0488406c55f4bf5a28ceb86138c948c: postsConnection(first: $first, skip: $skip, where: $where, orderBy: $orderBy) {
edges {
node {
status
updatedAt
createdAt
id
title
slug
category
preview
body
author
date
}
}
}
}
' // (change the ' for a tilde)
这是查询变量:
{"first":25,"skip":0,"orderBy":null,"where":{"AND":[]}}
我希望获取我 API 上的所有数据,以便将其呈现到我的应用程序中。我正在使用 Apollo 客户端。
解决方案
推荐阅读
- excel - 如何将值复制到最后一行
- excel - 有 Elseif 限制吗?
- symfony - 如何在 Symfony 日志中设置不同的错误级别
- powershell - 如何在 cmd 中设置一个变量,它是来自 powershell 命令结果的字符串?
- php - 解析?在 htaccess 中
- python - 在 python 中的数据帧上使用 group by 后,如何过滤数据帧以返回特定类型的记录?
- capl - 有没有办法让我在独木舟中调整参数?
- excel - 我可以使用这种方法将txt文件导入excel吗?
- cmake - 为什么 Cmake 不构建我的 vulkan/spirv 着色器?
- azure - 有没有办法在 IE11 中更改网络聊天字体大小