pestiand82

Reacthoz 2.0

May 30th, 2020
427
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     const show_image = () => {
  2.         let reader = new FileReader();
  3.  
  4.         // Closure to capture the file information.
  5.         reader.onload = (function() {
  6.         return function(e) {
  7.             // Render thumbnail.
  8.             image_canvas.current.src = e.target.result
  9.             image_canvas.current.style.display = "block"
  10.         };
  11.         })(selected_file);
  12.  
  13.         // Read in the image file as a data URL.
  14.         reader.readAsDataURL(selected_file);
  15.     }
Add Comment
Please, Sign In to add comment