Answers for "Error in /~/src/toast.js (11:89) posts.map is not a function"

0

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;
Posted by: Guest on May-24-2021

Code answers related to "Error in /~/src/toast.js (11:89) posts.map is not a function"

Code answers related to "Javascript"

Browse Popular Code Answers by Language