main
js 24 lines 709 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 */
7
8 /**
9 * `ReactInstanceMap` maintains a mapping from a public facing stateful
10 * instance (key) and the internal representation (value). This allows public
11 * methods to accept the user facing instance as an argument and map them back
12 * to internal methods.
13 *
14 * Note that this module is currently shared and assumed to be stateless.
15 * If this becomes an actual Map, that will break.
16 */
17
18 export function get(key) {
19 return key._reactInternals;
20 }
21
22 export function set(key, value) {
23 key._reactInternals = value;
24 }