Skip to content

zzarcon/react-memo

Repository files navigation

react-memo

React.memo polyfill

Install

$ yarn add react-memo-polyfill

Usage

import memo from 'react-memo-polyfill'

function MyComponent(props) { }

memo(MyComponent)

Optionally pass your compare function

import memo from 'react-memo-polyfill'

function MyComponent(props) { }
function areEqual(prevProps, nextProps) {
  /*
  return true if passing nextProps to render would return
  the same result as passing prevProps to render,
  otherwise return false
  */
}
export default memo(MyComponent, areEqual);

Author

@zzarcon