I'm getting the response similar to the following format from server.
{"channels": [{"name":"discovery", "id":"12",
"details":{"src":"link", "logo":"imagelink"}}]
I'm planning to use Redux-Orm to manage the state in the store. When I'm trying to define the model, I'm having confusions. One way is to define Channel Model with name and id as attributes, details as one to one mapping and Details Model with src, logo attributes as below.
const channel = class Channel extends Model {};
channel.fields = {
name: attr(),
id: attr(),
details: oneToOne('details', 'channels')
}
const details = class Details extends Model {};
details.fields = {
src: attr(),
logo: attr()
}
Or Should I define a single model class which represents the response as is? If so, how to define and access it?