Columbus March for Science Not Silence

The next Science March will take place in Washington, Göttingen and many other cities throughout the world on the 14th April 2018. This research activism movement born last year is set to gain…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




How To Create File Dropzone Component With React

Since we are creating single component there is no harm in placing it in src/index.js. The structure of the dropzone component is fairly simple. It is just div wrapping input component. And of course, some text telling user what to do. We are also using classNames for future styling. We need to make sure not to display input since it’s not very eye pleasing, but we still need it in order to open file dialog.

Now is the time to open system file dialog when the user clicks on the component. This dialog is opened after a user clicks on input which has type file. Since we are not displaying this input we need to use a little trick. We’re gonna add onClick handler to the dropzone component. And in this handler, we’re gonna use ref to trigger a click event on input.

Add a comment

Related posts:

Develop A Sound Plan With These Personal Finance Tips

Life can get quite complicated and tough if your finances are not in order.The following advice will give you get your finances into shape. Do thorough background research on any broker you cannot…

The Importance of Version Control and How You Can Utilize Git

Version control solves the problem of keeping track of changes made during your work process. i. e problems that arise when developing code that make it difficult to document and track which code…

House of Leaves

The youthful pair walked in easy silence, hand in hand beneath a leaden gray sky. The dead, by all appearances unaware of their passing, made little of their presence and afforded no greetings as…