Skip to content

Instantly share code, notes, and snippets.

@bdushimi
Created October 2, 2019 15:30
Show Gist options
  • Select an option

  • Save bdushimi/b2e9e7433aa5326bf40019be4fe94392 to your computer and use it in GitHub Desktop.

Select an option

Save bdushimi/b2e9e7433aa5326bf40019be4fe94392 to your computer and use it in GitHub Desktop.
Normalised Redux Store
{
posts : {
byId : {
"post1" : {
id : "post1",
author : "user1",
body : "......",
comments : ["comment1", "comment2"]
},
"post2" : {
id : "post2",
author : "user2",
body : "......",
comments : ["comment3", "comment4", "comment5"]
}
},
allIds : ["post1", "post2"]
},
comments : {
byId : {
"comment1" : {
id : "comment1",
author : "user2",
comment : ".....",
},
"comment2" : {
id : "comment2",
author : "user3",
comment : ".....",
},
"comment3" : {
id : "comment3",
author : "user3",
comment : ".....",
},
"comment4" : {
id : "comment4",
author : "user1",
comment : ".....",
},
"comment5" : {
id : "comment5",
author : "user3",
comment : ".....",
},
},
allIds : ["comment1", "comment2", "comment3", "commment4", "comment5"]
},
users : {
byId : {
"user1" : {
username : "user1",
name : "User 1",
},
"user2" : {
username : "user2",
name : "User 2",
},
"user3" : {
username : "user3",
name : "User 3",
}
},
allIds : ["user1", "user2", "user3"]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment