refs.tsx 471 B

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