Advertisement
robertvari

Simple PostList without axios

Apr 12th, 2020
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React from 'react';
  2. import Post from "./Post"
  3. import './PostList_style.css'
  4.  
  5. function PostList(props) {
  6.     const post_list = [
  7.         {
  8.             "id": 1,
  9.             "title": "Updated title 2",
  10.             "body": "updated body 2",
  11.             "created": "2020-04-10T16:36:14.692884Z"
  12.         },
  13.         {
  14.             "id": 2,
  15.             "title": "Second",
  16.             "body": "Second post",
  17.             "created": "2020-04-10T16:36:22.244885Z"
  18.         },
  19.         {
  20.             "id": 3,
  21.             "title": "Third",
  22.             "body": "Third post",
  23.             "created": "2020-04-10T16:36:31.386342Z"
  24.         },
  25.         {
  26.             "id": 4,
  27.             "title": "My latest post",
  28.             "body": "Hello there!",
  29.             "created": "2020-04-11T08:50:59.641843Z"
  30.         }
  31.     ];
  32.  
  33.  
  34.     return (
  35.         <div className="post_list_layout">
  36.             {post_list.map(post_data => <Post key={post_data.id} data={post_data}/>)}
  37.         </div>
  38.     );
  39. }
  40.  
  41. export default PostList;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement