I'm trying to call an API when the component mounts once. However, I can't do that without editing it to update the state after, as follows;
const [value, setValue] = useState(0)
const fetchData = async () => {
const data = await fetch(...)
setValue(data)
}
useEffect(() => {
fetchData()
}, [value]) // updating value useState
If I do that, I hit the API limit. The intended usage is for value to be updated but also run once.