UNPKG

862 BJavaScriptView Raw
1/**
2 * Copyright (c) 2016-present, Facebook, Inc.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 *
8 */
9
10'use strict';
11
12var warning = require('fbjs/lib/warning');
13
14if (process.env.NODE_ENV !== 'production') {
15 var processingChildContext = false;
16
17 var warnInvalidSetState = function () {
18 process.env.NODE_ENV !== 'production' ? warning(!processingChildContext, 'setState(...): Cannot call setState() inside getChildContext()') : void 0;
19 };
20}
21
22var ReactInvalidSetStateWarningHook = {
23 onBeginProcessingChildContext: function () {
24 processingChildContext = true;
25 },
26 onEndProcessingChildContext: function () {
27 processingChildContext = false;
28 },
29 onSetState: function () {
30 warnInvalidSetState();
31 }
32};
33
34module.exports = ReactInvalidSetStateWarningHook;
\No newline at end of file