如何为包含全局和本地派生数据的集合构建Redux选择器? 如何为具有全局和本地派生数据的集合构建Redux选择器?
我有一些数据看起来像:如何为包含全局和本地派生数据的集合构建Redux选择器? 如何为具有全局和本地派生数据的集合构建Redux选择器?,redux,react-redux,redux-form,reselect,Redux,React Redux,Redux Form,Reselect,我有一些数据看起来像: { palette: [1,0,1,1], children: [ { RootData: [...], }, //more children... ] } 我需要添加一些计算派生属性DerivedRoot和computedFromPalette和DerivedRoot { palette: [1,0,1,1], children: [ { RootData: [...], //
{
palette: [1,0,1,1],
children: [
{
RootData: [...],
},
//more children...
]
}
我需要添加一些计算派生属性DerivedRoot
和computedFromPalette和DerivedRoot
{
palette: [1,0,1,1],
children: [
{
RootData: [...],
// Local data for this child derived from the RootData
DerivedRoot: [],
// Additional data derived from global `palette` and local `RootData`
ComputedFromPaletteAndDerivedRoot: []
},
//more children...
]
}
我已经看过了,我不确定它是否是这个场景中使用的正确工具
单个子项的
RootData
值可能会更改,我不希望选择器应用于完整的子项集合,因为这会在单个子项更改时重新记忆所有子项。此外,每当调色板
发生更改时,子选择器都可以为从palette和DerivedRoot计算的重新计算一个新值
,我在过去遇到过类似的问题。我认为重新选择是正确的工具,您可能想使用。谢谢,@Josep我被推荐到其他地方研究它。我过去遇到过类似的问题。我认为重新选择是正确的工具,您可能想为此使用。谢谢,@Josep我被推荐到其他地方进行研究
{
palette: [1,0,1,1],
children: [
{
RootData: [...],
// Local data for this child derived from the RootData
DerivedRoot: [],
// Additional data derived from global `palette` and local `RootData`
ComputedFromPaletteAndDerivedRoot: []
},
//more children...
]
}