memo<P> function

ReactComponentBuilder<P> memo<P>(
  1. ReactComponentBuilder<P> component, {
  2. PropsAreEqual<P>? arePropsEqual,
})

Marks component for memoization.

The JavaScript and SSR renderers apply React.memo when component produces a registered component node.

See https://react.dev/reference/react/memo.

Implementation

ReactComponentBuilder<P> memo<P>(
  ReactComponentBuilder<P> component, {
  PropsAreEqual<P>? arePropsEqual,
}) =>
    (props) => MemoizedNode(
      component(props),
      arePropsEqual: arePropsEqual == null
          ? null
          : (previous, next) => arePropsEqual(previous as P, next as P),
    );