Skip to content
This repository was archived by the owner on Nov 23, 2026. It is now read-only.
bobred18Public archive

About

A custom hook, written for Apollo Server

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

react-graphql-hooks

A custom hook, written for Apollo Server

Usage

useDatabase

const fetch = useDatabase(query)

The useDatabase hook takes the following parameters:

  • query: backticks string of GraphQL query

Returns:

  • data: a GraphQL like JSON object. Your resolved queries will be inside this object
  • loading: a boolean to indicate if the data is still being loaded
  • error: a GraphQL error. undefined if there is no error

Example

const fetch = useDatabase(`#graphql
    {
        users {
            userId
            name
            bio
            profileImage
        }

         findPosts(postId: "${postId}"){
            postId
            description
            title
            createdAt
            user {
                userId
                name
                bio
                profileImage
            }
            
        }

        # ...Other queries
    }
`)

About

A custom hook, written for Apollo Server

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages