diff --git a/src/features/posts/Feed.js b/src/features/posts/Feed.js index d931285..ddccdea 100644 --- a/src/features/posts/Feed.js +++ b/src/features/posts/Feed.js @@ -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 - // - // ); - // } - // 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 ( <>