import React from 'react'; import PropTypes from 'prop-types'; import { Link } from 'react-router-dom'; import { UserType } from './Types'; import { info } from '../api'; import Avatar from './Avatar'; import Icon from './Icon'; import SearchBox from './SearchBox'; export default class UserInfo extends React.Component { constructor(props) { super(props); this.state = { user: { uname: props.user, uid: 0 } }; } componentDidMount() { info(this.state.user.uname).then(response => { this.setState({ user: response.data[0] }); }); } render() { const { user } = this.state; return (