Skip to content

Instantly share code, notes, and snippets.

View cant89's full-sized avatar
🏠
Working from home

Davide Cantelli cant89

🏠
Working from home
View GitHub Profile
import { useQuery } from 'react-query';
export const useFetchFirstTodo = () => {
const { data, error, isLoading } = useQuery("fetchFirstTodo", fetchFirstTodo);
// -> dispatch and action
// -> manipulate the response before sending back to component
// -> call another api
// -> whatever makes sense for you to put here...
return { data, error, isLoading }
}