2020-02-28 22:41:26 +03:00

13 lines
335 B
JavaScript

import { useQuery } from '@apollo/react-hooks'
const Query = ({ children, query, id }) => {
const { data, loading, error } = useQuery(query, {
variables: {id}
})
if (loading) return <p>loading...</p>
if (error) return <p>Error: {JSON.stringify(error)}</p>
return children({ data })
}
export default Query