import React, { useState, useEffect } from 'react'; import PropTypes from 'prop-types'; import { Link } from 'react-router-dom'; import { UserType } from './Types'; import Icon from './Icon'; import { fetchUserUri } from '../api'; import './Avatar.css'; let isMounted; function Avatar(props) { const [user, setUser] = useState(props.user); useEffect(() => { setUser(props.user); isMounted = true; return () => { isMounted = false; }; }, [props.user, user.uid, user.uri]); return (