DEV Community

Discussion on: The anatomy of a custom input[type="file"] component

Collapse
 
greduan profile image
Eduardo Lavaque

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.