「このような正規化されたオブジェクトがレビュックスストアにあるとしましょう。反応UIコンポーネントに正規化されたデータを表示
{
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
などの方法を実行しますか?
これは意味があります。私はメモやリセレクトライブラリに関する提案が好きです。それについて知らなかった...とにかく、このプロセスを理解してくれてありがとう。 – tito