Inside your useEffect you are logging list
:
console.log(list);
So you either need to remove the above line, or add list
to the useEffect dependencies at the end.
so change this line
}, [term]);
to
}, [term, list]);
Inside your useEffect you are logging list
:
console.log(list);
So you either need to remove the above line, or add list
to the useEffect dependencies at the end.
so change this line
}, [term]);
to
}, [term, list]);