@@ -74,69 +74,69 @@ An example of a normalized state structure for the blog example above might look
7474
7575``` js
7676{
77- posts : {
78- byId : {
79- " post1" : {
80- id : " post1" ,
81- author : " user1" ,
82- body : " ......" ,
83- comments : [" comment1" , " comment2" ]
77+ posts: {
78+ byId: {
79+ post1: {
80+ id: " post1" ,
81+ author : " user1" ,
82+ body : " ......" ,
83+ comments : [" comment1" , " comment2" ]
8484 },
85- " post2" : {
86- id : " post2" ,
87- author : " user2" ,
88- body : " ......" ,
89- comments : [" comment3" , " comment4" , " comment5" ]
85+ post2: {
86+ id : " post2" ,
87+ author : " user2" ,
88+ body : " ......" ,
89+ comments : [" comment3" , " comment4" , " comment5" ]
9090 }
9191 },
92- allIds : [" post1" , " post2" ]
92+ allIds: [" post1" , " post2" ]
9393 },
94- comments : {
95- byId : {
96- " comment1" : {
97- id : " comment1" ,
98- author : " user2" ,
99- comment : " ....." ,
94+ comments: {
95+ byId: {
96+ comment1: {
97+ id: " comment1" ,
98+ author: " user2" ,
99+ comment: " ....."
100100 },
101- " comment2" : {
102- id : " comment2" ,
103- author : " user3" ,
104- comment : " ....." ,
101+ comment2: {
102+ id: " comment2" ,
103+ author: " user3" ,
104+ comment: " ....."
105105 },
106- " comment3" : {
107- id : " comment3" ,
108- author : " user3" ,
109- comment : " ....." ,
106+ comment3: {
107+ id: " comment3" ,
108+ author: " user3" ,
109+ comment: " ....."
110110 },
111- " comment4" : {
112- id : " comment4" ,
113- author : " user1" ,
114- comment : " ....." ,
115- },
116- " comment5" : {
117- id : " comment5" ,
118- author : " user3" ,
119- comment : " ....." ,
111+ comment4: {
112+ id: " comment4" ,
113+ author: " user1" ,
114+ comment: " ....."
120115 },
116+ comment5: {
117+ id: " comment5" ,
118+ author: " user3" ,
119+ comment: " ....."
120+ }
121121 },
122- allIds : [" comment1" , " comment2" , " comment3" , " comment4" , " comment5" ]
122+ allIds: [" comment1" , " comment2" , " comment3" , " comment4" , " comment5" ]
123123 },
124- users : {
125- byId : {
126- " user1" : {
127- username : " user1" ,
128- name : " User 1" ,
124+ users: {
125+ byId: {
126+ user1: {
127+ username: " user1" ,
128+ name: " User 1"
129129 },
130- " user2" : {
131- username : " user2" ,
132- name : " User 2" ,
130+ user2: {
131+ username: " user2" ,
132+ name: " User 2"
133133 },
134- " user3" : {
135- username : " user3" ,
136- name : " User 3" ,
134+ user3: {
135+ username: " user3" ,
136+ name: " User 3"
137137 }
138138 },
139- allIds : [" user1" , " user2" , " user3" ]
139+ allIds: [" user1" , " user2" , " user3" ]
140140 }
141141}
142142```
@@ -158,11 +158,11 @@ A typical application will likely have a mixture of relational data and non-rela
158158{
159159 simpleDomainData1: {... .},
160160 simpleDomainData2: {... .},
161- entities : {
161+ entities: {
162162 entityType1 : {... .},
163163 entityType2 : {... .}
164164 },
165- ui : {
165+ ui: {
166166 uiSection1 : {... .},
167167 uiSection2 : {... .}
168168 }
@@ -178,28 +178,33 @@ Because we're treating a portion of our Redux store as a "database", many of the
178178``` js
179179{
180180 entities: {
181- authors : { byId : {}, allIds : [] },
182- books : { byId : {}, allIds : [] },
183- authorBook : {
184- byId : {
185- 1 : {
186- id : 1 ,
187- authorId : 5 ,
188- bookId : 22
181+ authors: {
182+ byId: {},
183+ allIds: []
184+ },
185+ books: {
186+ byId: {},
187+ allIds: []
188+ },
189+ authorBook: {
190+ byId: {
191+ 1 : {
192+ id: 1 ,
193+ authorId: 5 ,
194+ bookId: 22
189195 },
190- 2 : {
191- id : 2 ,
192- authorId : 5 ,
193- bookId : 15 ,
196+ 2 : {
197+ id: 2 ,
198+ authorId: 5 ,
199+ bookId: 15
194200 },
195- 3 : {
196- id : 3 ,
197- authorId : 42 ,
198- bookId : 12
201+ 3 : {
202+ id: 3 ,
203+ authorId: 42 ,
204+ bookId: 12
199205 }
200206 },
201- allIds : [1 , 2 , 3 ]
202-
207+ allIds: [1 , 2 , 3 ]
203208 }
204209 }
205210}
0 commit comments