Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

show uploaded image in react/nextjs

useEffect(() => {
   // create the preview
   const objectUrl = URL.createObjectURL(selectedFile)
   setPreview(objectUrl)

   // free memory when ever this component is unmounted
   return () => URL.revokeObjectURL(objectUrl)
}, [selectedFile])
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #show #uploaded #image
ADD COMMENT
Topic
Name
9+2 =