import React, { useRef } from "react"; import { ImageCropper, HiddenCropper } from "react-bootstrap-image-cropper"; import "bootstrap/dist/css/bootstrap.min.css"; function App() { return (

); } export default App; function ImageCropperDemo() { // if you don't care the onChange event, you can use a ref to retrieve the cropped file const fileRef = useRef(); function handleChange(croppedFile) { console.log(croppedFile); console.log(fileRef.current); // croppedFile === fileRef.current } return (

ImageCropper

); } function HiddenCropperDemo() { const triggerRef = useRef(); function handleCropped(file) { console.log(file); } return (

HiddenCropper

); }