CategoryContainer.js
688 Bytes
import React from "react";
import CategoryPresenter from "./CategoryPresenter";
import { withRouter } from "react-router-dom";
import { useQuery } from "@apollo/react-hooks";
import { GET_CATEGORIRES } 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);
let categories;
if (data !== undefined) {
const { getCategories } = data;
categories = getCategories;
}
return <CategoryPresenter location={location} categories={categories} />;
});