I have this code and I'm trying to add some IF statements to the submit button, so it does not submit anything empty, or other than numbers and arithmetic operators, or shows error when operands are more than operators and vice versa, however it doesn't seem to work. Here is the full code.
const handleSubmit = (e) => {
if (inputValue.length === 0) {
e.preventDefault();
setResult("You did not enter anything!")
}
if (inputValue === isNaN && inputValue !== validOperators) {
e.preventDefault();
setResult("only numbers!")
} else {
e.preventDefault();
setResult(solution);
setInputValue("");
}
}