Posts.js 456 B

12345678910111213141516171819202122
  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import { PostItem } from '../style';
  4. export default function Posts({ posts }) {
  5. return (
  6. <ul style={{ listStyle: 'none', padding: 0 }}>
  7. {posts.map((post, i) =>
  8. <PostItem key={i}>
  9. <a href={post.url} target="_blank">
  10. {post.title}
  11. </a>
  12. </PostItem>
  13. )}
  14. </ul>
  15. );
  16. }
  17. Posts.propTypes = {
  18. posts: PropTypes.array.isRequired
  19. };