xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

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 发布文章使用:只允许注册用户才可以访问!


posted @   xgqfrms  阅读(262)  评论(2编辑  收藏  举报
编辑推荐:
· 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
点击右上角即可分享
微信分享提示