ChatContainer.js
665 Bytes
import React from "react";
import { useSubscription, useMutation } from "@apollo/react-hooks";
import ChatPresenter from "./ChatPresenter";
import { withRouter } from "react-router-dom";
import { NEW_MESSAGE, SUBSCRIPTION_MSG } from "./ChatQueries";
import useInput from "../../Hooks/useInput";
export default withRouter(({ location }) => {
const [createMsg] = useMutation(NEW_MESSAGE);
const {
data: { subMessage },
} = useSubscription(SUBSCRIPTION_MSG);
const message = useInput("");
const onSubmit = async (e) => {
e.preventDefault();
};
return (
<ChatPresenter location={location} message={message} onSubmit={onSubmit} />
);
});