import React, { memo } from 'react'; import ReactRouterPropTypes from 'react-router-prop-types'; import { UserType } from './Types'; import qs from 'qs'; import MessageInput from './MessageInput'; import { post } from '../api'; function PostComponent(props) { let params = qs.parse(window.location.search.substring(1)); let postMessage = (template) => { const { attach, body } = template; post(body, attach) .then(response => { if (response.status === 200) { const msg = response.data.newMessage; this.props.history.push(`/${this.props.visitor.uname}/${msg.mid}`); } }).catch(console.log); }; return (
*weather It is very cold today!
); } export default memo(PostComponent); PostComponent.propTypes = { history: ReactRouterPropTypes.history.isRequired, visitor: UserType };