I have configured the useEffect to run only when its dependencies changes:
useEffect(() => {
localStorage.setItem("cart", JSON.stringify(cart));
}, [cart])
But when the component renders for the first time. useEffect hook will call Why?