JSPM

react-apollo-local-values

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q13325F
  • License BSD-3-Clause

easily get and set values from a apollo local state

Package Exports

  • react-apollo-local-values

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-apollo-local-values) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-apollo-local-values

npm License: BSD 3-clause "New" or "Revised" License standard-readme compliant

David David David

Table of Contents

Install

yarn add react-apollo-local-values
npm install react-apollo-local-values

Usage

to combine with apollo-link-state

import React from 'react';
import { graphql, compose } from 'react-apollo';
import Values from 'react-apollo-local-values';

const { set, get, resolve } = Values('my-namespace');

const Hello = ({ name, onNameChange }) => (
  <form>
    <p>{name}</p>
    <input type="text" onChange={ev => onNameChange(ev.target.value)} />
  </form>
);

export default compose(
  graphql(set('name'), {
    props: ({ mutate }) => ({
      onNameChange: (name = '') => mutate({ variables: { name } })
    })
  }),
  graphql(get('name'), {
    props: resolve
  })
)(Hello);

License

BSD-3-Clause