node/react-dropzone/typings/tests/refs.tsx
raw| 1 | import React, { createRef } from "react"; |
| 2 | import Dropzone, { DropzoneRef } from "../../"; |
| 3 | |
| 4 | const ref = createRef<DropzoneRef>(); |
| 5 | |
| 6 | export const dropzone = ( |
| 7 | <Dropzone ref={ref}> |
| 8 | {({ getRootProps, getInputProps }) => ( |
| 9 | <div {...getRootProps()}> |
| 10 | <input {...getInputProps()} /> |
| 11 | <p>Drop some files here.</p> |
| 12 | <button type="button" onClick={ref.current.open}> |
| 13 | Open file dialog |
| 14 | </button> |
| 15 | </div> |
| 16 | )} |
| 17 | </Dropzone> |
| 18 | ); |