react-file-picker
Sensible file input wrappers. Demo included.
npm i react-file-picker
Examples
const MyComponent = <FilePicker extensions='md' onChange= /* do something with File object */ onError= /* do something with err msg string */ > <button> Click to upload markdown </button> </FilePicker>)
const MyComponent = <ImagePicker extensions='jpg' 'jpeg' 'png' dims=minWidth: 100 maxWidth: 500 minHeight: 100 maxHeight: 500 onChange= /* do something with base64 encoded string */ onError= /* do something with err msg string */ > <button> Click to upload image </button> </ImagePicker>)
Demo
npm run demo