import React from 'react'; import PropTypes from 'prop-types'; import parse from 'html-react-parser'; /** * Displays a list of blog posts with the title and a short excerp from the content. * @param {object} props * { * posts: { * title: * excerpt: * } * } * @returns */ const PostList = ({ posts }) => { return ( <>

{posts.length} posts found

{posts.map((post, index) => (
{parse(post.title)}

{parse(post.excerpt)}

))} ); }; PostList.propTypes = { posts: PropTypes.object.isRequired } export default PostList;