I have 3 useEffect
functions each calling a updateData
function. (Each one is doing something else in addition to that so I can't combine them all.) Because of this, on page load, updateData
gets called 3 times.
Here's the relevant code:
useEffect(() => {
...
updateData();
}, [changePage]);
useEffect(() => {
...
updateData();
}, [search]);
useEffect(() => {
...
updateData();
}, [sortBy]);
How can I make sure that updateData
only gets called once on page load?