score:0

If setVisibleExtras changing extras it will always trigger whole useEffect again... if its your case, use callback function in setVisibleExtras instead:

useEffect(() => {
  if (extras.length && pkg ? .id) {
    setVisibleExtras((extras) =>
      extras.filter(({
          availableOnTariff
        }) =>
        availableOnTariff.some(({
          id
        }) => id === pkg.id)
      )
    );
    console.log('visible extras', visibleExtras);
  }
}, [pkg]);

Related Query

More Query from same tag