React + GraphQL 2020 速成课程
React + GraphQL 2020 速成课程
technologies
React (to build our user interface)
GraphQL (to get and change data in a declarative way)
Apollo Client (to allow us to use React and GraphQL together)
Hasura (to create and manage our GraphQL API + database)
import ApolloClient from "apollo-boost";
const client = new ApolloClient({
uri: "https://react-graphql.herokuapp.com/v1/graphql"
});
import React from "react";
import { useQuery } from "@apollo/react-hooks";
import { gql } from "apollo-boost";
export const GET_POSTS = gql`
query getPosts {
posts {
id
title
body
createdAt
}
}
`;
function App() {
const { data, loading } = useQuery(GET_POSTS);
if (loading) return <div>Loading...</div>;
if (data.posts.length === 0) return <Empty />;
return (
<>
<header className={classes.header}>
<h2 className={classes.h2}>All Posts</h2>
<Link to="/new" className={classes.newPost}>
New Post
</Link>
</header>
{data.posts.map(post => (
<Post key={post.id} post={post} />
))}
</>
);
}
refs
https://www.freecodecamp.org/news/the-react-graphql-2020-crash-course/
lectures
https://learn.codeartistry.io/courses/2020-react-graphql/lectures/19445637
https://learn.codeartistry.io/courses/2020-react-graphql/lectures/19445640
https://learn.codeartistry.io/courses/2020-react-graphql/lectures/19445642
https://learn.codeartistry.io/courses/2020-react-graphql/lectures/19445643
https://learn.codeartistry.io/courses/2020-react-graphql/lectures/19445638
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/13494630.html
未经授权禁止转载,违者必究!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)
2019-08-13 Enums & JavasScript & TypeScript
2019-08-13 javascript algorithm visualization
2019-08-13 React Native 三端同构
2018-08-13 Chrome & CORS & Fetch API All In One
2016-08-13 你所不知道的 JS: null , undefined, NaN, true==1=="1",false==0=="",null== undefined
2016-08-13 web 前端工具: Gulp 使用教程
2016-08-13 BB link All In One