Last active
April 26, 2017 08:42
-
-
Save nattatorn-dev/059909cdf400d5917976ad357d3971d9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// fetch api | |
{ | |
posts: [ | |
{ | |
id: 88, | |
content: 'North Korea News', | |
author: { | |
id: 41, | |
name: 'Kim Jong-un', | |
}, | |
}, | |
{ | |
id: 89, | |
content: 'USA News', | |
author: { | |
id: 42, | |
name: 'Donald Trump', | |
}, | |
}, | |
], | |
comments: [ | |
{ | |
id: 352, | |
post_id: 88, | |
body: 'Are you ready for world war 3?', | |
author: { | |
id: 42, | |
name: 'Donald Trump', | |
}, | |
}, | |
], | |
} | |
// Normalized | |
{ | |
posts: { | |
postIds: [ 88, 89 ], | |
postsById: { | |
88: { | |
content: 'North Korea News', | |
author: 41, | |
}, | |
89: { | |
content: 'USA News', | |
author: 42, | |
}, | |
}, | |
}, | |
comments: { | |
commentIds: [ 352 ], | |
commentsById: { | |
352: { | |
post_id: 88, | |
body: 'Are you ready for world war 3?', | |
author: 42, | |
}, | |
}, | |
}, | |
authors: { | |
authorsById: { | |
41: { | |
name: 'Kim Jong-un', | |
}, | |
42: { | |
name: 'Donald Trump', | |
}, | |
}, | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment