React Suite Uploader Component
React Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. Uploader component allows the user to upload files from the system. We can use the following approach in ReactJS to use the React Suite Uploader Component.
- accept: It is used to denote the file types that can be accepted.
- action: It is used to denote the uploading URL.
- autoUpload: It is used to denote the automatic upload files after selecting them.
- classPrefix: It is used to denote the prefix of the component CSS class.
- data: It is used to denote the upload of the parameters with.
- defaultFileList: It is used to denote the list of uploaded files.
- disabled: It is used to denote the disabled upload button.
- disabledFileItem: It is used to disable the file list.
- draggable: It is used to enable the drag and drop to upload.
- fileList: It is used to denote the list of uploaded files.
- fileListVisible: It is used to denote the file list is visible.
- headers: It is used to set the Upload request Header.
- listType: It is used to denote the upload list Style.
- maxPreviewFileSize: It is used to set the maximum limit for preview files.
- multiple: It is used to allow multiple file uploads to be selected at a time.
- name: It is used to upload the parameter name of the corresponding file.
- onChange: It is a callback function that the upload queue has changed.
- onError: It is a callback function that is triggered when an upload error occurs.
- onPreview: It is a callback function that is triggered on the preview of the uploaded file.
- onProgress: It is a callback function that uploads progress changes.
- onRemove: It is a callback function to delete the file.
- onReupload: It is a callback function that is used to re-upload the file.
- onSuccess: It is a callback function after a successful upload.
- onUpload: It is a callback function that starts the upload file.
- renderFileInfo: It is used for the custom render file information.
- removable: It is used to enable the removable list file.
- shouldQueueUpdate: It is used to allow the queue to be updated.
- shouldUpload: It is used to allow the uploading of files.
- timeout: It is used to set upload timeout.
- toggleComponentClass: It can be used for the custom element for this component.
- withCredentials: It is used to indicate whether to carry cookies when uploading requests.
Creating React Application And Installing Module:
Step 1: Create a React application using the following command:
npx create-react-app foldername
Step 2: After creating your project folder i.e. foldername, move to it using the following command:
Step 3: After creating the ReactJS application, Install the required module using the following command:
npm install rsuite
Project Structure: It will look like the following.
Example: Now write down the following code in the App.js file. Here, App is our default component where we have written our code.
Step to Run Application: Run the application using the following command from the root directory of the project:
Output: Now open your browser and go to http://localhost:3000/, you will see the following output:
Please Login to comment...