Remove duplicate API call + explicitly set loading state

This commit is contained in:
Gabe Kangas 2022-12-29 22:59:53 -08:00
parent 74c812ee12
commit 04b0f4548c
No known key found for this signature in database
GPG key ID: 4345B2060657F330

View file

@ -29,23 +29,16 @@ export const FollowerCollection: FC<FollowerCollectionProps> = ({ name, onFollow
setFollowers(results);
setTotal(totalResults);
setLoading(false);
} catch (error) {
console.error(error);
}
};
useEffect(() => {
getFollowers();
}, []);
useEffect(() => {
getFollowers();
}, [page]);
useEffect(() => {
setLoading(false);
}, [followers]);
const noFollowers = (
<div className={styles.noFollowers} id="followers-collection">
<h2>Be the first follower!</h2>