File tree 2 files changed +2
-6
lines changed
2 files changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -8,16 +8,12 @@ import { PostList } from './components/PostList';
8
8
const postsWithUsers = postsFromServer . map ( post => ( {
9
9
...post ,
10
10
user : usersFromServer . find ( user => user . id === post . userId ) ,
11
- } ) ) ;
12
-
13
- const postsWithComments = postsWithUsers . map ( post => ( {
14
- ...post ,
15
11
comments : commentsFromServer . filter ( comment => comment . postId === post . id ) ,
16
12
} ) ) ;
17
13
18
14
export const App = ( ) => (
19
15
< section className = "App" >
20
16
< h1 className = "App__title" > Static list of posts</ h1 >
21
- < PostList posts = { postsWithComments } />
17
+ < PostList posts = { postsWithUsers } />
22
18
</ section >
23
19
) ;
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ export const PostInfo = ({ post }) => (
7
7
< h3 className = "PostInfo__title" > { post . title } </ h3 >
8
8
< p >
9
9
{ ' Posted by ' }
10
- < UserInfo user = { post . user } />
10
+ { post . user && < UserInfo user = { post . user } /> }
11
11
</ p >
12
12
</ div >
13
13
< p className = "PostInfo__body" > { post . body } </ p >
You can’t perform that action at this time.
0 commit comments