Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

What's the equivalent of this in typescript? [closed]

$
0
0

I can use the following block in react to upload an image and show it:

function FileUpload() {    const [file, setFile] = React.useState("");    function handleUpload(event) {        setFile(event.target.files[0]);    }    return (<div id="upload-box"><input type="file" onChange={handleUpload} />            {file && <ImageThumb image={file} />}</div>    );}const ImageThumb = ({ image }) => {    return <img src={URL.createObjectURL(image)} alt={image.name} />;};

However, what's the equivalent of this in typescript. Especially with the event handler. Thanks!


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>