main
js 23 lines 596 Bytes
Raw
1 /**
2 * Copyright (c) Meta Platforms, 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 * @flow
8 */
9
10 import ReactSharedInternals from 'shared/ReactSharedInternals';
11
12 export function captureOwnerStack(): null | string {
13 if (__DEV__) {
14 const getCurrentStack = ReactSharedInternals.getCurrentStack;
15 if (getCurrentStack === null) {
16 return null;
17 }
18 // The current stack will be the owner stack which it is always here.
19 return getCurrentStack();
20 }
21
22 return null;
23 }