import { QueryOptions , useQuery } from "@apollo/client" ; import { useMemo } from "react" ; import LIST_RECIPES_QUERY from "graphql/queries/listRecipes" ; param queryOptions const useListRecipes = ( queryOptions ? ) => { const { data , loading } = useQuery ( LIST_RECIPES_QUERY , queryOptions ) ; const payload = useMemo ( ( ) => ( { data : data ?. recipes ?? [ ] , loading , } ) , [ data , loading , ] ) ; return payload ; } ; export default useListRecipes ;