JSFiddle - React, Tailwind, and code Playground

HTML

<input type='button' class='addPhoto' value='press me' />

JavaScript

$('.addPhoto').on("click",function(){
    $(this).off("click").replaceWith("<input type='file' class='addPhoto'/>");
});