Error in /~/src/toast.js (11:89) posts.map is not a function code example
Example: Error in /~/src/toast.js (11:89) posts.map is not a function
import React from 'react';
const Posts = ({ posts, loading }) => {
if (loading) {
return <h2>Loading...</h2>;
}
return (
<ul className='list-group mb-4'>
{posts.map(post => (
<li key={post.id} className='list-group-item'>
{post.title}
</li>
))}
</ul>
);
};
export default Posts;