All Projects → apollographql → Ac3 State Management Examples

apollographql / Ac3 State Management Examples

✨ Learn Apollo Client 3's state management best practices

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Ac3 State Management Examples

clean architecture
Clean Architecture Simple App.
Stars: ✭ 16 (-94.43%)
Mutual labels:  example
Vaporschool
Learn how to build vapor applications from rookie to champion in a constructive way!
Stars: ✭ 259 (-9.76%)
Mutual labels:  example
Echox
Echo cookbook and website
Stars: ✭ 275 (-4.18%)
Mutual labels:  example
Examples Win32
Shows how to use Win32 controls by programming code (c++17).
Stars: ✭ 22 (-92.33%)
Mutual labels:  example
Ember Apollo Client
🚀 An ember-cli addon for Apollo Client and GraphQL
Stars: ✭ 257 (-10.45%)
Mutual labels:  apollo-client
Project Minimek
A sample app to demonstrate various useful Redux techniques, accompanying the blog series at http://blog.isquaredsoftware.com/series/practical-redux
Stars: ✭ 266 (-7.32%)
Mutual labels:  example
reddit-clone
Reddit Clone using Laravel 5.4 / Clon de Reddit usando Laravel 5.4
Stars: ✭ 22 (-92.33%)
Mutual labels:  example
Avenging
MVP pattern example on Android: no Dagger or RxJava example
Stars: ✭ 279 (-2.79%)
Mutual labels:  example
Create React App Typescript Todo Example 2020
🚀 Create React App TypeScript Todo Example 2020
Stars: ✭ 255 (-11.15%)
Mutual labels:  example
Twitter Clone Frontend
Twitter Clone Frontend
Stars: ✭ 271 (-5.57%)
Mutual labels:  apollo-client
angular-apollo-starter
Learning apollo-client, graphql with angular6.x
Stars: ✭ 16 (-94.43%)
Mutual labels:  apollo-client
Rpcx Examples
examples for the latest rpcx
Stars: ✭ 256 (-10.8%)
Mutual labels:  example
Daemon
Simple example of daemon for Linux
Stars: ✭ 267 (-6.97%)
Mutual labels:  example
cobra-example
minimal example of cobra app
Stars: ✭ 43 (-85.02%)
Mutual labels:  example
Cleancppproject
Clean C++ project for you to use. Features: Modern CMake, CPack, Doxygen, PlantUML, Catch Unit testing, static analysis
Stars: ✭ 276 (-3.83%)
Mutual labels:  example
mean-stack-angular-8-blog-cms
MEAN Stack (Angular 8) Tutorial: Build a Simple Blog CMS Example
Stars: ✭ 19 (-93.38%)
Mutual labels:  example
Flutter Ui Nice
More than 130+ pages in this beautiful app and more than 45 developers has contributed to it.
Stars: ✭ 3,092 (+977.35%)
Mutual labels:  example
Apollo Client
🚀  A fully-featured, production ready caching GraphQL client for every UI framework and GraphQL server.
Stars: ✭ 17,070 (+5847.74%)
Mutual labels:  apollo-client
Examples
Many examples of Raku code
Stars: ✭ 276 (-3.83%)
Mutual labels:  example
Api Docs
api.nasa.gov
Stars: ✭ 267 (-6.97%)
Mutual labels:  example

Apollo Client 3 State Management Examples

Learn how to use AC3 for local and remote state management

About

Apollo Client 3 is a GraphQL client that allows you to easily query the exact data you need from a GraphQL server. In addition to fetching and mutating data, Apollo analyzes your queries and their results to construct a client-side cache of your data, which is kept up to date as further queries and mutations are run, fetching more results from the server.

We have found that it can be challenging for developers coming from another state management library (like Redux) to fully grasp the AC3-way of doing things.

What we're building

This repo contains several versions of the same Todo app, both Apollo Client and Redux examples, to demonstrate best practices on using Apollo Client to build applications using solely local state in addition to the real-world remote state use case.

Examples

Apollo Local State Example

Summary: Using Apollo Client 3's Reactive Variables API (docs here, blog post here), we can store the entire application state locally (and optionally persist it using local storage).

Check out the local state example.

Apollo Remote State Example

Summary: Hooking Apollo Client up to a remote GraphQL API, the client-side cache is smart enough to automatically update the cache after most mutations successfully complete. For mutations that perform interactions against arrays or have additional client-side side-effects, we can help the cache decide what to do next by writing our update logic in the useMutation's update function. This approach uses the writeQuery and readQuery APIs which are recommended for those starting out with Apollo Client.

Check out the remote state example

Apollo Remote State Advanced Cache APIs Example

Summary: This example is the same as the previous remote state example, except that this time, we're using the new AC3 cache manipulation APIs: cache.modify and cache.evict. This approach is recommended for users who are comfortable with how cache normalization works in Apollo Client and who want direct control over the cache.

Check out the remote state (advanced cache APIs) example

Apollo Remote State (No Relay) Example

Summary: This example is the same as the previous remote state example, except that it doesn't use a Relay-style GraphQL schema. This is mostly used for presentations to keep code succinct.

Check out the remote state (no-relay) example

Redux Local State Example

Summary: The Redux architecture provides us with a well-defined mental model for how to update state in an immutable way. We've provided this example in order to compare how to accomplish the same tasks in AC3 and in Redux.

Check out the local state (with Redux) example

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].