main
js 20 lines 461 Bytes
Raw
1 /**
2 * Copyright (c) Meta Platforms, Inc. and 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 * @flow
7 */
8
9 import type {RefObject} from 'shared/ReactTypes';
10
11 // an immutable object with a single mutable value
12 export function createRef(): RefObject {
13 const refObject = {
14 current: null,
15 };
16 if (__DEV__) {
17 Object.seal(refObject);
18 }
19 return refObject;
20 }