removing useless code

This commit is contained in:
2022-01-27 17:08:05 -06:00
parent a0d0e4ece4
commit d0de8db5df

View File

@@ -89,7 +89,7 @@ export default function Feed() {
);
})
setFeed(newFeed);
setFeed(newFeed); // stores this array of posts in feed
}
}
@@ -101,44 +101,6 @@ export default function Feed() {
}
}, [data, setFeed])
// useEffect(() => {
// let isActive = true;
// const getPosts = async() => {
// let myPosts = await dispatch(fetchBySub('https://www.reddit.com/r/cats.json'));
// myPosts = myPosts.payload; // sets myPosts to be the array of post objects fetched from the subreddit argument
// if (typeof myPosts === 'object' && isActive) {
// let newFeed = [];
// for (let post of myPosts) { // maps the data retrieved from fetchBySub onto Post components,
// newFeed.push( // then stores them in localized array
// <Post
// title={post.data.title}
// author={post.data.author}
// subreddit={post.data.subreddit}
// ups={post.data.ups}
// comments={post.data.num_comments}
// time={post.data.created_utc}
// key={v4()}
// media={post.data.post_hint === 'image' && post.data.url}
// permalink={post.data.permalink}
// selftext={post.data.selftext}
// video={post.data.is_video ? post.data.media.reddit_video.fallback_url : null}
// />
// );
// }
// setFeed(newFeed); // once populated, this array is sent to state as "feed" and rendered in this function's return method
// }
// };
// getPosts();
// return () => {
// isActive = false;
// }
// }, [dispatch])
return (
<>