import React, { useEffect } from "react"; import { Row, Col } from "react-bootstrap"; import CreatePost from "./CreatePost"; import MiniPhotos from "./MiniPhotos"; import MiniFriends from "./MiniFriends"; import DisplayUserPost from "./DisplayUserPost"; import { handleClickLink } from "./helper"; import { useSelector } from "react-redux"; import "./Posts.css"; const Posts = (props) => { const { userID, linkHandling } = props; const { linkRefs, linkState } = linkHandling; const [activeLink, setActiveLink] = linkState; const { posts: postsLinkRef } = linkRefs; const users = useSelector((state) => state.users); const currentUserID = useSelector((state) => state.user.id); const isCurrentUser = userID === currentUserID; const user = users.find((user) => user.userID === userID); useEffect(() => { handleClickLink( { currentTarget: postsLinkRef.current }, activeLink, setActiveLink ); }, [activeLink, postsLinkRef, setActiveLink]); return ( {user.posts.map((postID, index) => { return ( ); })} ); }; export default Posts;