sdy

add useState

import React from "react";
import React, { useState } 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 [action, setAction] = useState("showList");
const { data } = useQuery(GET_ROOMS);
let roomArray;
if (data !== undefined) {
const { getRooms } = data;
roomArray = getRooms;
}
return <RoomPresenter roomArray={roomArray} />;
return <RoomPresenter roomArray={roomArray} action={action} />;
});
......