mirror of
https://github.com/zebrajr/react.git
synced 2025-12-07 00:20:28 +01:00
24 lines
570 B
JavaScript
24 lines
570 B
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
* @flow
|
|
*/
|
|
|
|
import type {ReactScope} from 'shared/ReactTypes';
|
|
import {REACT_SCOPE_TYPE} from 'shared/ReactSymbols';
|
|
|
|
export default function createScope(
|
|
fn: (type: string | Object, props: Object) => boolean,
|
|
): ReactScope {
|
|
const scopeComponent = {
|
|
$$typeof: REACT_SCOPE_TYPE,
|
|
fn,
|
|
};
|
|
if (__DEV__) {
|
|
Object.freeze(scopeComponent);
|
|
}
|
|
return scopeComponent;
|
|
}
|