1 | ;
|
2 |
|
3 | const { createContext } = require('react');
|
4 |
|
5 | /**
|
6 | * React context for a [`Cache`]{@link Cache} instance.
|
7 | * @kind member
|
8 | * @name CacheContext
|
9 | * @type {object}
|
10 | * @prop {Function} Provider [React context provider component](https://reactjs.org/docs/context.html#contextprovider).
|
11 | * @prop {Function} Consumer [React context consumer component](https://reactjs.org/docs/context.html#contextconsumer).
|
12 | * @example <caption>Ways to `import`.</caption>
|
13 | * ```js
|
14 | * import { CacheContext } from 'graphql-react';
|
15 | * ```
|
16 | *
|
17 | * ```js
|
18 | * import CacheContext from 'graphql-react/public/CacheContext.js';
|
19 | * ```
|
20 | * @example <caption>Ways to `require`.</caption>
|
21 | * ```js
|
22 | * const { CacheContext } = require('graphql-react');
|
23 | * ```
|
24 | *
|
25 | * ```js
|
26 | * const CacheContext = require('graphql-react/public/CacheContext');
|
27 | * ```
|
28 | */
|
29 | const CacheContext = createContext();
|
30 |
|
31 | if (typeof process === 'object' && process.env.NODE_ENV !== 'production')
|
32 | CacheContext.displayName = 'CacheContext';
|
33 |
|
34 | module.exports = CacheContext;
|