我正在尝试将API响应直接映射到我的Redux-Orm模型。我有两个模型:
Product hasMany ProductProperties
ProductProperty belongsTo Product我收到的API响应是:
{
products: [
{name: 'P1', id: 1},
{name: 'P2', id: 2}
],
product_properties: [
{name: 'Test1', id: 10, product_id: 1},
{name: 'Test2', id: 11, product_id: 1},
{name: 'Test3', id: 12, product_id: 2}
{name: 'Test4', id: 13, product_id: 2}
]
}我可以调整API响应以匹配redux-orm。
我的问题是:
我希望避免使用ProductProperty.first()产品({.set: Product.first}) --也就是说,我不希望显式地设置关联(子记录),并让redux-orm自动推断它们。
有没有什么方法可以指定redux-orm可以查找的外键?
https://stackoverflow.com/questions/44497657
复制相似问题