2
Ich muss diese Daten zu normalisieren, so dass ich sowohl ein Array von Listen und ein anderes von Todos haben.Verschachtelte Arrays in Normalizr Schema
const data = [
{
_id: '1',
title: 'List1',
todos: [
{
_id: "11",
text: "Test1"
}
]
},
{
_id: '2',
title: 'List2',
todos: [
{
_id: "22",
text: "Test2"
}
]
}
];
Hier ist, was ich habe:
const todo = new schema.Entity('todos',{},{ idAttribute: '_id'});
const list = new schema.Entity('lists',{todos:todo},{idAttribute: '_id'});
const normalizedData = normalize(data, list);
console.log(normalizedData);
Ich habe ihre Beispiele versucht, aber keiner von ihnen scheinen für diese Daten zu arbeiten.
Jede Hilfe wäre willkommen.
Wo ist 'redux' und' react'? – lux