node/react-dropzone/typings/tests/hook.tsx
raw| 1 | import React from "react"; |
| 2 | import { useDropzone, DropzoneProps } from "../../"; |
| 3 | |
| 4 | export const Dropzone = ({ children, ...opts }: DropzoneProps) => { |
| 5 | const { ...state } = useDropzone(opts); |
| 6 | return children(state); |
| 7 | }; |
| 8 | |
| 9 | <Dropzone> |
| 10 | {({ getRootProps, getInputProps }) => ( |
| 11 | <div {...getRootProps()}> |
| 12 | <input {...getInputProps()} /> |
| 13 | </div> |
| 14 | )} |
| 15 | </Dropzone>; |