redux ストアでこのようなオブジェクトを正規化したとしましょう。
{
entities: {
plans: {
1: {title: 'A', exercises: [1, 2, 3]},
2: {title: 'B', exercises: [5, 6]}
},
exercises: {
1: {title: 'exe1'},
2: {title: 'exe2'},
3: {title: 'exe3'}
5: {title: 'exe5'}
6: {title: 'exe6'}
}
},
currentPlans: [1, 2]
}
UIコンポーネントで各計画の演習の詳細を表示したい。何かのようなもの。
plan 1
title A
exercises
exercise 1
title: 'exe1'
exercise 2
title: 'exe2'
..........
plan 2
title B
exercises
exercise 5
title: 'exe5'
........
もう一度非正規化する必要がありますか? データを変換する方法と場所は? 次のようなことをするために connectStateToProps を使用しますか?
plans: some mapping function that will create nested plans->exercise array
または別の方法がありますか?