Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ |
Using npm:
$ npm install react-express-graphql
Once the package is installed, you can import the library using import
approach:
import {query , mutation} from "react-express-graphql"
import { query } from "react-express-graphql"
// Define the query
let querystring=`
category() {
_id
}
`
// Make a request for a query
let baseurl="http://localhost:7002/graphql"
// Store the response
const response = await query(baseurl, querystring);
import { mutation } from "react-express-graphql"
// Define the mutation
let mutationstring= `
createCategory(categoryInput: $CategoryInput) {
_id
email,
}
`
// Make a request for a query
let baseurl="http://localhost:7002/graphql"
const response = await mutation(baseurl, mutationstring);