UNPKG

react-esm

Version:

React is a JavaScript library for building user interfaces.

22 lines (21 loc) 734 B
/** * 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. */ import { REACT_MEMO_TYPE } from 'shared/ReactSymbols'; import isValidElementType from 'shared/isValidElementType'; import warningWithoutStack from 'shared/warningWithoutStack'; export default function memo(type, compare) { if (__DEV__) { if (!isValidElementType(type)) { warningWithoutStack(false, 'memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type); } } return { $$typeof: REACT_MEMO_TYPE, type, compare: compare === undefined ? null : compare }; }