RoomContainer.js 445 Bytes
import React from "react";
import { useQuery } from "@apollo/react-hooks";
import { withRouter } from "react-router-dom";
import RoomPresenter from "./RoomPresenter";
import { GET_ROOMS } from "./RoomQueries";

export default withRouter(() => {
  const { data } = useQuery(GET_ROOMS);
  let roomArray;
  if (data !== undefined) {
    const { getRooms } = data;
    roomArray = getRooms;
  }
  return <RoomPresenter roomArray={roomArray} />;
});