re: The anatomy of a custom input[type="file"] component VIEW POST

re: Dude, no where you have mentioned where to write this code chunk, function generatePreviewImgUrl(file, callback) { const reader = new FileReader...

Hey sorry for the slow response.

That function doesn't need a particular location. It just needs to be available to the code that needs it. So it's up to you where to put it.

As I recall, that output from the function is the correct output. It encodes the image into text and tells the img tag to load it from there when you put it in its src tag.

code of conduct - report abuse