0

"react-dropzone": "^14.2.2"

 const { getRootProps, getInputProps, isDragActive } = useDropzone({
    accept: {
      "image/*": [".jpeg", ".png", ".jpg"],
    },

Error:

MediaField.tsx:266:5 - error TS2322: Type 'string | { "image/*": string[]; }' is not assignable to type 'Accept'.
  Type 'string' is not assignable to type 'Accept'.

266     accept: {
        ~~~~~~

  node_modules/react-dropzone/typings/react-dropzone.d.ts:31:3
    31   accept?: Accept;
         ~~~~~~
    The expected type comes from property 'accept' which is declared here on type 'DropzoneOptions'

What do I miss?

Kok How Teh
  • 3,298
  • 6
  • 47
  • 85

1 Answers1

0

Use this code Instead.

 accept:{
    'image/png': ['.png'],
    'image/jpg': ['.jpg'],
    'image/jpeg': ['.jpeg'],
    },