Have control which navigate to same page with different values in url
Case 1 - Below code invokes useEffect infinite times after clicking navigate
const queryValues = queryString.parse(search);
const { trip } = queryValues;
useEffect(() => {
console.log('Calling infinite times');
},[trip]));
Case 2 - If I change code to below then useEffect never call again any updates to url by clicking navigation button
useEffect(() => {
const queryValues = queryString.parse(search);
const { trip } = queryValues;
console.log('Calling infinite times');
},[]));
You are missing the closing bracket in both useEffect cases.
useEffect(() => {
const queryValues = queryString.parse(search);
const { trip } = queryValues;
console.log('Calling infinite times');
},[])