Infinite loop in useEffect
Passing an empty array as the second argument to useEffect makes it only run on mount and unmount, thus stopping any infinite loops. useEffect(() => { setIngredients({}); }, []); This was clarified to me in the blog post on React hooks at https://www.robinwieruch.de/react-hooks/