title: ReactJS: Resize image before upload
body: <p>In my reactJs project, I need to resize image before uploading it. </p>
  
  <p>I am using <a href="https://www.npmjs.com/package/react-image-file-resizer" rel="noreferrer">react-image-file-resizer</a> library which has a simple example but not working for me. </p>
  
  <p>I have tried this but its shows me blank result. What am I doing wrong?</p>
  
  <pre><code>var imageURI = '';
  const resizedImg = await Resizer.imageFileResizer(
    fileList.fileList[0].originFileObj,
    300,
    300,
    'JPEG',
    100,
    0,
    uri  =&gt; {
      imageURI = uri 
      console.log(uri )  // this show the correct result I want but outside of this function
    },
    'blob'
  );
  console.log(resizedImg)
  console.log(imageURI)
  
  // upload new image
  ...uploading image here.. 
  </code></pre>
  
  <p>If I do <code>imgRef.put(uri);</code> inside URI function then image upload works. but I need to do that outside of that function. </p>
  
  <p>how to get result in imageURI variable and reuse it later ?</p>