diff --git a/public/favicon.ico b/public/favicon.ico index 354202a..fc7cf46 100644 Binary files a/public/favicon.ico and b/public/favicon.ico differ diff --git a/public/index.html b/public/index.html index 1dbdca6..e1ade2e 100644 --- a/public/index.html +++ b/public/index.html @@ -24,7 +24,7 @@ work correctly both with client-side routing and a non-root public URL. Learn how to configure a non-root public URL by running `npm run build`. --> - React Redux App + Cat Reddit diff --git a/src/features/posts/Feed.js b/src/features/posts/Feed.js index 96e3e02..1ad0345 100644 --- a/src/features/posts/Feed.js +++ b/src/features/posts/Feed.js @@ -1,8 +1,8 @@ import React, { useState, useEffect } from "react"; -import { fetchBySub, selectPosts } from "./postsSlice"; +import { fetchBySub, /* selectPosts */ } from "./postsSlice"; import { selectAllSubs } from "../reddit/redditSlice"; import { useSelector, useDispatch } from "react-redux"; -import { updatePosts } from "./postsSlice"; +// import { updatePosts } from "./postsSlice"; import { v4 } from "uuid"; import Post from "./Post"; @@ -12,7 +12,7 @@ export default function Feed() { const [feed, setFeed] = useState(null); // Expects to receive an array of Post components mapped with data from fetchBySub const dispatch = useDispatch(); - const posts = useSelector(selectPosts); + // const posts = useSelector(selectPosts); const subs = useSelector(selectAllSubs); // Selects subreddits from redditSlice useEffect(() => { // this useEffect loop pulls the endpoints from the selected subreddits and stores them as an array in "endpoints" @@ -38,8 +38,6 @@ export default function Feed() { useEffect(() => { // once this is done, this loop pulls posts from each endpoint - let isActive = true; - const getPosts = async(arr) => { if (endpoints) { const mappedResults = arr.map(each => dispatch(fetchBySub(each))); // maps each endpoint into a call to dispatch fetchBySub @@ -50,11 +48,6 @@ export default function Feed() { } getPosts(endpoints); - - return () => { - isActive = false; - } - }, [dispatch, setData, endpoints]); useEffect(() => { diff --git a/src/features/posts/Post.js b/src/features/posts/Post.js index 51c833b..aaaea2a 100644 --- a/src/features/posts/Post.js +++ b/src/features/posts/Post.js @@ -1,5 +1,5 @@ import React, { useState, useEffect } from "react"; -import { useDispatch } from "react-redux"; +// import { useDispatch } from "react-redux"; import Discussion from "../discussion/Discussion"; import './Post.css'; @@ -20,7 +20,6 @@ export default function Post({data, key}) { const [body, setBody] = useState(selftext); const [visible, setVisible] = useState('show '); const [commentStyle, setCommentStyle] = useState('comments-hidden'); - const [crosspost, setCrosspost] = useState(undefined); const postDate = new Date(time * 1000); // handles conversion from unix timestamp to local time and date strings const localTime = postDate.toLocaleTimeString();