import React from 'react'; import { Link } from 'react-router-dom'; 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 (