Skip to content

Instantly share code, notes, and snippets.

@gugl
Last active October 20, 2015 11:59
Show Gist options
  • Save gugl/80c348e95c9ade3f0101 to your computer and use it in GitHub Desktop.
Save gugl/80c348e95c9ade3f0101 to your computer and use it in GitHub Desktop.
Whats the best store tree structure so that it still make sense to use combineReducers?
var example = {
selectedTodoList: 'tl-1',
todosByTodoList: {
'tl-1': {
lastUpdated: 1439478405547,
items: ['t-1', 't-2']
}
},
attachmentsByTodo: {
't-1': {
lastUpdated: 1439478405547,
items: ['a-1']
}
},
entities: {
todoLists: {
'tl-1': {
id: 'tl-1',
title: 'First TodoList'
}
},
todos: {
't-1': {
id: 't-1',
todoListId: 'tl-1',
summary: 'First Task'
},
't-2': {
id: 't-2',
todoListId: 'tl-1',
summary: 'Second Task'
}
},
attachments: {
'a-1': {
id: 'a-1',
url: 'http://example.come/file123.pdf?token=456'
}
}
}
};
var exampleInline = {
selectedTodoList: 'tl-1',
entities: {
todoLists: {
'tl-1': {
id: 'tl-1',
title: 'First TodoList',
todos: {
lastUpdated: 1439478405547,
items: ['t-1', 't-2']
}
}
},
todos: {
't-1': {
id: 't-1',
todoListId: 'tl-1',
summary: 'First Task',
attachments: {
lastUpdated: 1439478405547,
items: ['a-1']
}
},
't-2': {
id: 't-2',
todoListId: 'tl-1',
summary: 'Second Task'
}
},
attachments: {
'a-1': {
id: 'a-1',
url: 'http://example.come/file123.pdf?token=456'
}
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment