Updating FlatList data with useState infinitely recurs in React Native
I’m trying to set the data for a flatlist with useState, but updating the state causes the component to re-render, so it calls the getInventory function again and infinitely recurs, crashing the app. I’m using a function component, not class. If I put the getInventory bit in a useEffect, it doesn’t crash, but the useEffect function in the InventoryItem components is constantly called. I can’t see what I’m doing wrong