Skip to content

Instantly share code, notes, and snippets.

@rubystar rubystar/state structure
Last active Jul 4, 2017

Embed
What would you like to do?
redux state structure
//Widgets
{
byId: {
1: {
settings:{name: 'report 1', description: 'report 1 desc'},
child_widget_ids: [10, 11]
},
2: {
settings:{name: 'report 2', description: 'report 2 desc'},
child_widget_ids: [12, 13]
},
11: {
foo: bar
},
12: {
} // and so on...
}
allIds: [1, 2, 11, 12, ...]
}
// in order to get a report from store
currWid = store.get("widgets").get("byId")(1)
// chart instances for the selected report
currWid.get("child_widgets_ids").map((item) => store.get("widgets").byId("item"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.