0

I have a memoized functional component. Once the parent library component renders, react calls update memo component to check whether my func. component needs to render again. The comparison "current.ref === workInProgress.ref" fails and causes rerender of my functional component.

function updateMemoComponent(current, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
 if (compare(prevProps, nextProps) && current.ref === workInProgress.ref) {

What does "current.ref === workInProgress.ref" comparison mean? Can you please suggest me good doc to understand this ? TIA

  • Is this your custom comparison function or a function provided by react ? – Anand Raj Jan 15 '21 at 10:52
  • It's basically the second argument that we pass to use memo (default shallow check / custom function we provide). I created a custom function that always returns true. This check is also passing – user9381708 Jan 15 '21 at 10:53
  • Also this updateMemoComponent function is a function in react's code. Not my code – user9381708 Jan 15 '21 at 10:59

0 Answers0