Material-UI-Dropzone Typescript Example

Intro

This NPM plugin: https://www.npmjs.com/package/material-ui-dropzone
is very popular, however the examples are in JavaScript. Here’s a typescript equivalent of their posted example:

import React, { useState } from "react";
import { DropzoneAreaBase } from "material-ui-dropzone";
import "./styles.css";
const Home = () => {
const [files, setFiles] = useState([]);
const handleAdd = (newFiles: any) => {
setFiles([...files]);
};

--

--

--

Most of my writing is about software. I enjoy summarizing and analyzing books and self-help videos. I am a full-time software engineer.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Manipulating Arrays in JavaScript

ECMAScript 2019. Asynchronous iteration using “for-of”

How to Make a Custom Slider Component in Vue

Vue Custom Slider Component

[C++] Functions

Top Tips and Tricks Every JS Developer should know

Using the Unity Animation System to Control Player Animation States

Beautiful Language and Beautiful Code

language

Statements and expressions

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
janac

janac

Most of my writing is about software. I enjoy summarizing and analyzing books and self-help videos. I am a full-time software engineer.

More from Medium

How to protect /uploads route with a custom policy in Strapi V4

Custom Service Worker in any app with esbuild

Toggle Tab with Vanilla TypeScript and WAI-ARIA

Update AntD Form errors with i18next in React