I have a from with an input type file. I want to upload an image to backend to folder upload/images. With submit form (with button) everything is working. No problem.
NO! I want to make it when onChange until submitting form. When I submit form, I just want to patch path of image to user. My question, with useEffect, is it possible to send request POST to backend?
CodePudding user response:
You can use On change function in your input field and and send to server using post request.
CodePudding user response:
useEffect works when the component is created. If you wanna send a request while components create, yes you can. Just create a function with useCallback and call that function inside useEffect.