Skip to content

Instantly share code, notes, and snippets.

@AndrewRayCode
Created January 12, 2016 23:36
Show Gist options
  • Select an option

  • Save AndrewRayCode/9cfc60068a06e31ebd5a to your computer and use it in GitHub Desktop.

Select an option

Save AndrewRayCode/9cfc60068a06e31ebd5a to your computer and use it in GitHub Desktop.
How to store nested data in Flux
// Bad! Not normalized, nested
classrooms: [{
id: 1,
name: 'Math',
students: [{
id: 1,
name: 'Sally'
}]
}]
// Good! Normalized, not nested
classrooms: [{
id: 1,
name: 'Math',
students: [ 1 ] // Only id of student!
}],
students: [{
id: 1,
name: 'Sally'
}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment