I have two endpoints
api/instruction api/subject
from my server, model Instructions has a reference field called subject.
On my react-admin frontend, I'd like to CREATE(CRUD) a new Instruction instance.
Following this tutorial I have implemented my InstructionCreate as below
export const InstructionCreate = (props) => (
<Create title="New Instruction"{...props}>
<SimpleForm>
<ReferenceInput label="Subject" source="subject" reference="subject/">
<SelectInput optionText="name" />
</ReferenceInput>
</SimpleForm>
</Create>
When I render my Create component, from chrome console, under networktab, I can see a list of subject objects returned.
The list has two objects(pulled from server) and the objects have a property 'name'
However, i get a console error
Uncaught TypeError: Cannot read property 'data' of undefined
The above error occurred in the
In case one needs my app.js, from which I can successfully CRUD the api/subject endpoint
const App = () => (
<Admin
dataProvider={dataProvider}
<Resource name="subject" title="Subjects" list={SubjectList} create={SubjectCreate} edit={SubjectEdit} icon={GroupIcon}/>
<Resource name="instruction" title="Instructions" list={InstructionList} edit={InstructionEdit} create={InstructionCreate} icon={InstructionIcon}/>
</Admin>
);
GET api/subject - returns a list of dictionaries
[ { "id": 2, "name": "Subject 2" }, { "id": 1, "name": "Subject 1" } ]
ra-data-simple-restprovider