import React from 'react' ; import { useStore , useSelector } from 'react-redux' ; import { loadFeedList } from '@app/redux/actions/feed' ; import { getFeedListById } from '@app/redux/reducers/feed' ; import PostsItem from '@app/components/posts-list/components/item-rich' ; import CommentItem from './components/item-comment' ; import ListClass from '@app/class/list' ; import './styles/index.scss' ; interface Props { id : string ; query : object ; scrollLoad ? : boolean ; showPagination ? : boolean ; nothing ? : any ; } export default function ( props ) { const { id } = props ; const store = useStore ( ) ; const list = useSelector ( ( state ) => getFeedListById ( state , id ) ) ; return ( < ListClass { ... props } { ... list } load = { ( params ) => loadFeedList ( params ) ( store . dispatch , store . getState ) } renderItem = { ( item ) => { if ( item . comment_id ) { return ( < CommentItem key = { item . _id } posts = { item . posts_id } comment = { item . comment_id } / > ) ; } else if ( item . posts_id ) { return ( < PostsItem key = { item . _id } posts = { item . posts_id } switchHasRead = { false } / > ) ; } } } />); }