0.0.3 • Published 5 years ago
drop-file-provider v0.0.3
##DROP FILE REACT
Simple component to takes files dropped in a
####Documentation
DropProvider
offers a surrounding component that's
implements drop files interface.
Props
props | Description |
---|---|
onDrop | function executed when some file is dropped in DropProvider children. Receive a files array |
backdrop | function that's return a component to be rendered when some file is hovering the childrens of DropProvider. |
####Example
imṕort React from 'react';
import {DropProvider} from "drop-file-provider";
const App =>() {
const read = files =>{
files.forEach(file => {
const fileReader = new FileReader();
fileReader.onload = ()=>console.log(fileReader.result);
fileReader.readAsBinaryString(file);
});
};
return (
<DropProvider onDrop={read} backdrop={()=><span>Test</span>}>
<h4>DROP HERE SOME TEXT FILE </h4>
</DropProvider>
);
}```