Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

227
Views
How to convert images to WEBP before sending them to Firebase using React-dropzone

For performance, I need to reduce the size of the images I send to my cloud storage (firebase). Through some research I came to know webp is the way to go but I'm using react dropzone and I have to idea how to work these 2 together.

DragAndDrop.js

function DragAndDrop() {
  const [files, setFiles] = useState([]);

  const { getRootProps, getInputProps } = useDropzone({
    accept: "image/*",
    maxFiles: 5,
    onDrop: (acceptedFiles) => {
      setFiles((files) => [
        ...files,
        ...acceptedFiles.map((file) =>
          Object.assign(file, {
            key: file.name + randomId(), // to allow adding files with same name
            preview: URL.createObjectURL(file),
          })
        ),
      ]);
    },
  });
 
  const thumbs = files.map((file, i) => (
    <div style={thumb} key={file.key}>
      <div style={thumbInner}>
        <img src={file.preview} style={img} alt="imported images" />
      </div>
      <button type="button" style={removeButton} onClick={() => removeFile(i)}>
        X
      </button>
    </div>
  ));

  useEffect(
    () => () => {
      files.forEach((file) => URL.revokeObjectURL(file.preview));
    },
    [files]
  );

}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!