From f507e0639cb29ccf74926177e7230255f07648fb Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 25 Feb 2019 19:35:49 +0300 Subject: UploadButton using hooks --- vnext/src/components/UploadButton.js | 37 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 21 deletions(-) (limited to 'vnext') diff --git a/vnext/src/components/UploadButton.js b/vnext/src/components/UploadButton.js index 5dfa7a1d..115ff32e 100644 --- a/vnext/src/components/UploadButton.js +++ b/vnext/src/components/UploadButton.js @@ -3,32 +3,27 @@ import PropTypes from 'prop-types'; import Icon from './Icon'; -export default class UploadButton extends React.Component { - constructor(props) { - super(props); - } - openfile = () => { - const input = this.props.inputRef.current; - if (this.props.value) { - this.props.onChange(''); +export default function UploadButton(props) { + let openfile = () => { + const input = props.inputRef.current; + if (props.value) { + props.onChange(''); } else { input.click(); } } - attachmentChanged = (event) => { - this.props.onChange(event.target.value); - } - render() { - return ( -