rules={{
required: {
value: required,
message: 'This field is required',
},
validate: {
fileType: (file) =>
!required ||
validFileTypes.indexOf(file.type) != -1 ||
'We only support (pdf, doc, docx, txt, rtf)',
},
}}