我想用 规范化我的数据normalizr
。问题是我的数据中有一个键 ( teams
),它与其他数据没有关系。
例如:
const data = {
programs: [{
id: 1,
label: 'Program one',
products: [{
id: 1,
label: 'Product one',
releases: [{
id: 1,
label: 'Release one',
}]
}
]
}
],
teams: [{
id: 1,
value: 1,
label: 'Team one',
}
]
}
我的架构:
const release = new schema.Entity('releases');
const product = new schema.Entity('products', {
releases: [release]
});
const program = new schema.Entity('programs', {
products: [product],
});
normalize(data, [program]);
我怎样才能将团队添加到由生成的实体对象中normalizr
?所以结果需要是:
{
entities: {
products: {},
programs: {},
releases: {},
teams: []
}
}