'Maximum calls setState inside useEffect
Here I have load data from using a hook, but I have got many times loading and maximum update depth. I have using react application. How can I fix this issue?
This is my code:
const [items] = LoadItems();
const [data, setData] = useState([]);
useEffect(() => {
const item = items?.filter(item => item?.category === 'regular');
setData(item);
}, [items]);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
