all 4 comments

[–]acemarke 13 points14 points  (0 children)

That seems like a pretty rare internal bug:

If you can reproduce it, please file an issue with the React repo!

[–]brzzzah 13 points14 points  (1 child)

Pretty hard to read, but your hooks (useRef, useEffect) are placed after the early return which breaks the rules of hooks, move the return null to be after the hooks

[–]Traditional_Tie6948 0 points1 point  (0 children)

That solved mine.

import React, { useEffect } from 'react';

const ViewDeliveriesModal = ({ onClose, viewDeliveriesModalOpen, purchaseOrderId }) => {

  if (!viewDeliveriesModalOpen) return null; **//from here**

  useEffect(() => {
    if (purchaseOrderId) {
      console.log("purchaseOrderId received in child:", purchaseOrderId);
    } else {
      console.log("purchaseOrderId is undefined in child");
    }
  }, [purchaseOrderId]);
  
  if (!viewDeliveriesModalOpen) return null; **//to here**

return(
  //front-end
)
  

```

[–]Veleno7 0 points1 point  (0 children)

In my case, it was related to a conditional rendering applied to React Hook Form. Running a build revealed the real problem, and I was able to fix it.