UNPKG

573 BJavaScriptView Raw
1/**
2 * Copyright (c) Facebook, Inc. and its affiliates.
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 * @emails oncall+relay
8 *
9 * @format
10 */
11'use strict';
12
13var _require = require('react'),
14 useEffect = _require.useEffect,
15 useRef = _require.useRef;
16
17function useIsMountedRef() {
18 var isMountedRef = useRef(true);
19 useEffect(function () {
20 return function () {
21 isMountedRef.current = false;
22 };
23 }, []);
24 return isMountedRef;
25}
26
27module.exports = useIsMountedRef;
\No newline at end of file