Exciting news!Announcing our $4.6M Series Seed. Learn more
Socket
LoveBlogFAQ
Install
Log in

apollo-link-redux

Package Overview
Dependencies
2
Maintainers
1
Versions
10
Issues
File Explorer

Advanced tools

apollo-link-redux

Dispatches apollo-client 1.0-ish actions.

    0.2.1latest

Version published
Maintainers
1
Yearly downloads
44,654
decreased by-3.36%

Weekly downloads

Changelog

Source

0.2.1

  • Add a test for operationName

Readme

Source

apollo-link-redux

Dispatches apollo-client 1.0-ish actions.

Why?

While there are still Apollo Client 1.0 applications out there in the wild, this provides a little shim to back fill redux actions previously dispatched in Apollo Client 1.0 as you migrate to Apollo Client 2.0. (This link is framework agnostic despite the reference to React migration docs).

apollo-link-redux is intended to compliment apps that also use redux. It is not encouraging that redux also manage application state of GraphQL query and mutation responses. That is a job done much better by an Apollo Client cache.

Supported Actions

APOLLO_QUERY_INIT APOLLO_QUERY_RESULT APOLLO_MUTATION_INIT APOLLO_MUTATION_RESULT APOLLO_SUBSCRIPTION_INIT APOLLO_SUBSCRIPTION_RESULT

All actions have operationName, variables and document. *_RESULT actions will also contain result.

Setup

npm i -S apollo-link-redux

(peer dependencies)

npm i -S apollo-link graphql import { ApolloClient } from 'apollo-client'; import { ApolloLink } from 'apollo-link'; import ReduxLink from 'apollo-link-redux'; import { HttpLink } from 'apollo-link-http'; const link = ApolloLink.from([ new ReduxLink(store), new HttpLink() ]); const client = new ApolloClient({ link });

Example usage

import { APOLLO_MUTATION_RESULT } from 'apollo-link-redux'; export function mutationFooCounter(state = { count: 0 }, action) { if ( action.operationName === 'MutateFoo' && action.type === APOLLO_MUTATION_RESULT ) { const count = state.count + 1; return { count }; } return state; }

Tests

npm test

Support

  • > 1% market share browsers.

Keywords

FAQs

What is apollo-link-redux?

Dispatches apollo-client 1.0-ish actions.

Is apollo-link-redux popular?

The npm package apollo-link-redux receives a total of 240 weekly downloads. As such, apollo-link-redux popularity was classified as not popular.

Is apollo-link-redux well maintained?

We found that apollo-link-redux demonstrated a not healthy version release cadence and project activity. It has 1 open source maintainer collaborating on the project.

Last updated on 05 Feb 2018
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc