useEffect with dependency on useShippingAddress is called 2x

Can anyone enlighten me as to why this would be called twice when checkout loads?

useEffect(() => {
fetch();
}, [shippingAddress]);

Hi,

If shippingAddress is an object or array, even minor changes (like reference changes) will cause the useEffect to re-run. This could be what’s happening here?

Yes but no shippingAddress changes are taking place

Are you using any React hooks like useState ?

Yes - although seems like the entire function itself is firing 2x

Can you share the code? Or other details

Are you using React <StrictMode>?
Strict Mode renders components twice (on dev but not production) in order to detect any problems with your code and warn you about them (which can be quite useful).

Holy cow you are right, I totally forgot about that.