mirror of
https://github.com/twisterarmy/twister-react.git
synced 2025-01-27 15:14:30 +00:00
36 lines
1.2 KiB
JavaScript
36 lines
1.2 KiB
JavaScript
/**
|
|
* Copyright 2015, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*
|
|
* @providesModule ReactLifeCycle
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
/**
|
|
* This module manages the bookkeeping when a component is in the process
|
|
* of being mounted or being unmounted. This is used as a way to enforce
|
|
* invariants (or warnings) when it is not recommended to call
|
|
* setState/forceUpdate.
|
|
*
|
|
* currentlyMountingInstance: During the construction phase, it is not possible
|
|
* to trigger an update since the instance is not fully mounted yet. However, we
|
|
* currently allow this as a convenience for mutating the initial state.
|
|
*
|
|
* currentlyUnmountingInstance: During the unmounting phase, the instance is
|
|
* still mounted and can therefore schedule an update. However, this is not
|
|
* recommended and probably an error since it's about to be unmounted.
|
|
* Therefore we still want to trigger in an error for that case.
|
|
*/
|
|
|
|
var ReactLifeCycle = {
|
|
currentlyMountingInstance: null,
|
|
currentlyUnmountingInstance: null
|
|
};
|
|
|
|
module.exports = ReactLifeCycle;
|