DEV Community

Cover image for File Upload in React
sharath mohan
sharath mohan

Posted on

File Upload in React

Working with file upload is one of those things you somehow wind up doing. Here is a small article on doing the same in React
First of all, we need to understand on how refs work in React. Ref's act as pointers on DOM elements, like how you would be selecting an element using say

docuemnt is selector
and the useContext Hook to manage those ref's

In this example, I have created a ref called inputRef that is connected to the input element, each element connected to the ref can a current property on which you can use all the properties supported by that element, in this case value

ref example

lets add the FileType, FormData and fetch API


Top comments (0)