UNPKG

1.05 kBJavaScriptView Raw
1'use strict';
2
3const { createContext } = require('react');
4
5/**
6 * React context for a [`Loading`]{@link Loading} instance.
7 * @kind member
8 * @name LoadingContext
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 { LoadingContext } from 'graphql-react';
15 * ```
16 *
17 * ```js
18 * import LoadingContext from 'graphql-react/public/LoadingContext.js';
19 * ```
20 * @example <caption>Ways to `require`.</caption>
21 * ```js
22 * const { LoadingContext } = require('graphql-react');
23 * ```
24 *
25 * ```js
26 * const LoadingContext = require('graphql-react/public/LoadingContext');
27 * ```
28 */
29const LoadingContext = createContext();
30
31if (typeof process === 'object' && process.env.NODE_ENV !== 'production')
32 LoadingContext.displayName = 'LoadingContext';
33
34module.exports = LoadingContext;