Removed state

This commit is contained in:
CrispyBaguette 2021-12-11 16:51:45 +01:00
parent 71f4a89ef9
commit a8f15df46d

View File

@ -1,9 +1,8 @@
import React, { useEffect } from "react";
import React from "react";
import "./App.css";
function App() {
const [imageSrc, setImageSrc] = React.useState("");
const [displayOutput, setDisplayOutput] = React.useState(false);
const fileInput = React.useRef<HTMLInputElement>(null);
const handleClick = async () => {
@ -12,7 +11,6 @@ function App() {
}
const workerProxy: any = await wasmWorker("main.wasm");
setDisplayOutput(false);
setImageSrc("");
// Check if a file was selected
@ -28,7 +26,6 @@ function App() {
const ditheredImage = await workerProxy.DitherNord(imageData);
const outputValue = `data:image/png;base64,${ditheredImage}`;
setImageSrc(outputValue);
setDisplayOutput(true);
}
};
};
@ -50,7 +47,7 @@ function App() {
id="output"
alt="dithering output"
src={imageSrc}
style={{ display: displayOutput ? "block" : "none" }}
style={{ display: imageSrc !== "" ? "block" : "none" }}
/>
</div>
</a>