Code Monkey home page Code Monkey logo

graphql-demo's Introduction

GraphQL Serverside Setup

  • git checkout server
  • Apollo graphQL server Setup

GraphQL Client Side

  1. React client setup

    • git checkout step-01
  2. Apollo client setup & API Query

    • git checkout step-02
    • Fetch data from external graphQL API
    • Apollo chrome extension
    • Show what apollo cache contains
  3. Apollo client & hooks

    • git checkout step-03
    • Apollo provider wrapped around APP Component
    • Apollo chrome externsion configured by passing "connectToDevTools": true to ApolloClient
    • Use Apollo extension to figure out the query needed to fetch data
  4. Querying Data

    • git checkout step-04
    • Use useQuery method from apollo/react-hook to run query
    • Show useQuery from apollo docs
    • Add some dummy data to show the Pet list items
  5. Mutation

    • git checkout step-05
    • Use variables to pass input data
    • Use useMutation hook to create a new pet
  6. Keeping Cache in Sync

    • git checkout step-06
    • Refetching matching queries after a mutation
    • Use update method on mutation
    • Watch queries
    • Don't need refresh to see the latest created item
  7. Optimistic UI updates

    • git checkout step-07
    • Introduce a delay in client using ApolloLink.from & SetTimeout
    • Start an OptimisticResponse within createPet
  8. Client Side Schema

    • git checkout step-08
    • How to manage local state with Apollo & GraphQL using client side schemas. By adding a directive.
    • Verify with a console.log to see the age property in the user data
  9. Fragments

    • git checkout step-09
    • Instead of duplicating fields within different queries, one can use fragments.

graphql-demo's People

Contributors

dependabot[bot] avatar samarpanda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

graphql-demo's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.