CategoryContainer.js 606 Bytes
import React from "react";
import CategoryPresenter from "./CategoryPresenter";
import { withRouter } from "react-router-dom";
import { useMutation, useQuery } from "@apollo/react-hooks";
import {
  GET_CATEGORIRES,
  ADD_CATEGORY,
  EDIT_CATEGORY,
  DELETE_CATEGORY,
} from "./CategoryQueries";

export default withRouter(({ location }) => {
  const { data } = useQuery(GET_CATEGORIRES);
  const [addCategory] = useMutation(ADD_CATEGORY);
  const [editCategory] = useMutation(EDIT_CATEGORY);
  const [deleteCategory] = useMutation(DELETE_CATEGORY);
  return <CategoryPresenter location={location} />;
});