React Admin - ReferenceInput with multiple fields output

304 views Asked by At

I'm using React with React Admin to populate my database in which I have 2 collections: products and stores

I need to link a store to the product, so normally I should do:

<ReferenceInput label="Store" source="storeId" reference="stores">
  <SelectInput optionText="name" />
</ReferenceInput>

But this will generate this structure:

{
  id: '...'
  // other attributes
  storeId: "choosed-store-id"
}

But the final result I need is something like this:

{
  id: '...'
  // other attributes
  store: {
    id: "choosed-store-id",
    name: "choosed-store-name",
    address: "choosed-store-address"
  }
}
0

There are 0 answers