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
Table of Contents
Install
yarn add react-apollo-local-valuesnpm install react-apollo-local-valuesUsage
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