ユーザーが多くの猫をお気に入りに登録しており、ユーザーのお気に入りを尋ねられたときに API エンドポイントが猫のリストを提供するとします。
const catsList = [{id:1,name:"catA"},{id:2,name:"catB"},{id:3,name:"catC"}];
// ex: GET http://app.com/api/favorites => results in following json
{favorites:[{id:2,name:"catB"},{id:3,name:"catC"}]}
// the result is the list of cats
//and normalizr schema
const cats = new Schema('cats');
const favorites = new Schema('favorites');
今私の質問は、次の結果が得られるようにこれらのエンティティをどのように正規化するかです。
entities.favorites=[2,3]; //2 and 3 are cats
entities.cats=[{id:1,name:"a"},{id:2,name:"b"},{id:3,name:"c"}];
normalizr でこれを達成するにはどうすればよいですか?