fortana-co / react-dropzone-uploader

React file dropzone and uploader
https://react-dropzone-uploader.js.org/
MIT License
444 stars 183 forks source link

Get key props error with custom component #173

Open anujshah108 opened 2 years ago

anujshah108 commented 2 years ago
const FeedbackFileUpload = () => {
  return (
    <FileUploaderDropzone>
      <FileUploaderIcon>
        <Publish />
      </FileUploaderIcon>
      <FileUploaderTitle variant="subtitle2">
        Drag and Drop Files
      </FileUploaderTitle>
      <FileUploaderBrowse variant="subtitle1">Browse Files</FileUploaderBrowse>
    </FileUploaderDropzone>
  );
};

I have this custom component that I insert into inputContent

     <Dropzone
        // disabled={Boolean(response || loading)}
          key={dropzoneKey}
          onChangeStatus={handleChangeStatus}
          submitButtonDisabled={true}
          inputContent={<FeedbackFileUpload />}
        />

I get the error:

index.js:1 Warning: Each child in a list should have a unique "key" prop. See https://reactjs.org/link/warning-keys for more information. at label at O (http://localhost:3000/static/js/vendors~main.chunk.js:246033:15) at div

Any help?

audree1 commented 2 years ago

I starting receiving that warning as well.

diegolego commented 2 years ago

Same problem. Just add a unique key to each "inputContent" element. That will make the warning disappear.