Closed Pitfall-cmd closed 2 years ago
import React from 'react' import { useSelector } from 'react-redux' export const PostsList = () => { const posts = useSelector(state=> state.posts) console.log(posts) //undefined //console.log(123456) const renderedPosts = posts.map((post) => ( //Uncaught TypeError: Cannot read properties of undefined (reading 'map') <article className="post-excerpt" key={post.id}> <h3>{post.title}</h3> <p className="post-content">{post.content.substring(0, 100)}</p> </article> )) return ( <section className="posts-list"> <h2>Posts</h2> {renderedPosts} </section> ) }
sorry anybody can help me !!
sorry anybody can help me !!