I have a input of type file. For some reason it doesn't let me change the value attribute to it and it looks ugly. I swapped it with a button but now I need the button to somehow trigger the input file onChange. How can I do this in react?
<div> <input id="inputFile" type='file' className='mt-2 mb-3 text-primary' onChange={uploadProfilePic} /> <button type='button' className='btn btn-primary py-2 px-5 mb-3' onClick={fireInput} > Upload Picture </button> </div>
https://stackoverflow.com/questions/67015343/how-do-i-make-a-button-trigger-an-input-onchange-in-react April 09, 2021 at 01:06PM
没有评论:
发表评论