How to use the react-is.Memo function in react-is

To help you get started, weโ€™ve selected a few react-is examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FormidableLabs / react-ssr-prepass / src / symbols.js View on Github external
| 'react.suspense' /* 0xead1 | Symbol(react.suspense) */
  | 'react.memo' /* 0xead3 | Symbol(react.memo) */
  | 'react.lazy' /* 0xead4 | Symbol(react.lazy) */

export const REACT_ELEMENT_TYPE: 'react.element' = is.Element
export const REACT_PORTAL_TYPE: 'react.portal' = is.Portal
export const REACT_FRAGMENT_TYPE: 'react.fragment' = is.Fragment
export const REACT_STRICT_MODE_TYPE: 'react.strict_mode' = is.StrictMode
export const REACT_PROFILER_TYPE: 'react.profiler' = is.Profiler
export const REACT_PROVIDER_TYPE: 'react.provider' = is.ContextProvider
export const REACT_CONTEXT_TYPE: 'react.context' = is.ContextConsumer
export const REACT_CONCURRENT_MODE_TYPE: 'react.concurrent_mode' =
  is.ConcurrentMode
export const REACT_FORWARD_REF_TYPE: 'react.forward_ref' = is.ForwardRef
export const REACT_SUSPENSE_TYPE: 'react.suspense' = is.Suspense
export const REACT_MEMO_TYPE: 'react.memo' = is.Memo
export const REACT_LAZY_TYPE: 'react.lazy' = is.Lazy
github makuga01 / dnsFookup / FE / node_modules / hoist-non-react-statics / dist / hoist-non-react-statics.cjs.js View on Github external
render: true,
  defaultProps: true,
  displayName: true,
  propTypes: true
};
var MEMO_STATICS = {
  '$$typeof': true,
  compare: true,
  defaultProps: true,
  displayName: true,
  propTypes: true,
  type: true
};
var TYPE_STATICS = {};
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;

function getStatics(component) {
  // React v16.11 and below
  if (reactIs.isMemo(component)) {
    return MEMO_STATICS;
  } // React v16.12 and above


  return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
}

var defineProperty = Object.defineProperty;
var getOwnPropertyNames = Object.getOwnPropertyNames;
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
var getPrototypeOf = Object.getPrototypeOf;
github milesj / rut / packages / rut / src / internals / react.ts View on Github external
if (ReactIs.isForwardRef(type) || typeOf === ReactIs.ForwardRef) {
    return 'ForwardRef'; // We lose the component name
  }

  if (ReactIs.isFragment(type) || typeOf === ReactIs.Fragment) {
    return 'Fragment';
  }

  if (ReactIs.isLazy(type) || typeOf === ReactIs.Lazy) {
    return 'Lazy';
  }

  if (ReactIs.isMemo(type)) {
    return getTypeName(type.type);
  } else if (typeOf === ReactIs.Memo) {
    return `Memo(${getTypeName(type.type)})`;
  }

  if (ReactIs.isProfiler(type) || typeOf === ReactIs.Profiler) {
    return `Profiler(${type.props!.id})`;
  }

  if (ReactIs.isPortal(type) || typeOf === ReactIs.Portal) {
    const portal = type as PortalLike;

    return `Portal(${portal.containerInfo.id || portal.containerInfo.tagName.toLowerCase()})`;
  }

  if (ReactIs.isStrictMode(type) || typeOf === ReactIs.StrictMode) {
    return 'StrictMode';
  }