2

I create SimpleForm with ImageInput.

I followed the instructions in the document: https://marmelab.com/admin-on-rest/Inputs.html#imageinput This is my code:

export const PostCreate = (props) => (
    <Create actions={<PostCreateEditActions/>} {...props}>
        <SimpleForm toolbar={<PostCreateEditToolbar/>} defaultValue={postCreateDefaultValue}>        
            <ImageInput source="pictures" label="画像" accept="image/*" >
                <ImageField source="src"/>
            </ImageInput>
        </SimpleForm>
    </Create>
);

But when the console logs error:

bundle.js:4903 Warning: Stateless function components cannot be given refs. Attempts to access this ref will fail.

Check the render method of TextField.

Could you explain the cause of the error?

Rick
  • 1,177
  • 1
  • 19
  • 27
Hòa Võ
  • 21
  • 3
  • Please upload your `TextField` component – Siya Mzam Dec 05 '17 at 09:18
  • It not have TextField, My page only have a , as in the attached code – Hòa Võ Dec 05 '17 at 09:21
  • If you didn't, then the error would not say `Check the render method of TextField` – Siya Mzam Dec 05 '17 at 09:39
  • I don't think this is a duplicate. I believe @Hoa is looking for help with the `admin-on-rest` framework and the referenced duplicate question above is not especially helpful. I'm having a similar issue; `TextField` is a component provided by this framework, so editing it is not a great solution. – quicklikerabbit Dec 08 '17 at 20:08
  • 1
    oh, @quicklikerabbit, thank you for you comment. Actually! This is a problem when running webpack in developer mode, (webpack -d), When you run in prodcuction mode, this error will be gone (webpack -p). – Hòa Võ Dec 11 '17 at 03:33

0 Answers0