Hi!
Don’t know why, but in my side every time that I refresh my page. The useTodos get request is called 4 times. I noticed that in Mosh videos this is not happening. Can someone explain?
Heres my config for the request:
const useTodos = () => {
const fetchTodos = axios
.get<Todo[]>("https://jsonplaceholder.typicode.com/todos")
.then((res) => res.data);
return useQuery<Todo[], Error>({
queryKey: ["todos"],
queryFn: () => fetchTodos,
staleTime: 10 * 1000, // 10 seconds
});
};