import { Link, Avatar } from 'theme-ui'
import { memo, useState, useEffect } from 'react'
import { trim } from 'lodash'
const Mention = memo(function Mention({ username }) {
const [img, setImg] = useState(null)
useEffect(() => {
fetch(`https://scrapbook.hackclub.com/api/profiles/${trim(username)}`)
.then(r => r.json())
.then(profile => setImg(profile.avatar))
.catch(console.error)
}, [username])
return (
{img && (
)}
@{username}
)
})
export default Mention