🚨 Add username to deps array

This commit is contained in:
Malted 2023-04-06 22:48:39 +01:00
parent 7207898245
commit 63bd41a0cf
No known key found for this signature in database
GPG key ID: C1AF1C0E5180BE02

View file

@ -4,13 +4,14 @@ import { trim } from 'lodash'
const Mention = memo(function Mention({ username }) {
const [img, setImg] = useState(null)
useEffect(() => {
try {
fetch(`https://scrapbook.hackclub.com/api/profiles/${trim(username)}`)
.then(r => r.json())
.then(profile => setImg(profile.avatar))
} catch (e) {}
}, [])
fetch(`https://scrapbook.hackclub.com/api/profiles/${trim(username)}`)
.then(r => r.json())
.then(profile => setImg(profile.avatar))
.catch(e => console.error(e))
}, [username])
return (
<Link
href={`https://scrapbook.hackclub.com/${username}`}