Does React.memo create a singleton component or can it be used to create multiple independent instances

Viewed 353

When wrapping a component function in React.memo, is the result a singleton (similar to reselect's createSelector method), meaning that it's primarily designed for a single instance? Or does each reference to the resulting memoized component create its own separate memoized instance?

Example: Is this a valid use of React.memo?

const Item = React.memo((props) => <li>...</li>);

// App
render(): {
  const { items } = this.props
  return (
    <ul>
      {items.map((item) => <Item {...item} />)}
    </ul>
  );
}
0 Answers
Related