api.tsreactnative

import { useQuery } from "@tanstack/react-query"
import { fetchPostsAPI } from "./api"

export const usePosts = () => {
    const { data, isLoading, isError, isSuccess } = useQuery({
        queryKey: ['fetch-posts'],
        queryFn: fetchPostsAPI
    });

    return {
        data,
        isLoading,
        isError,
        isSuccess
    }
}

Comments

Popular posts from this blog

interview questions js[ Anurag Singh ProCodrr]

reactnative_creation