I am writing a function which checks the input value.
const [input, setInput] = useState("")
<input type="text" value={input} onBlur={handleCheckValue} onChange={(e) => setInput(e.target.value)} />
And the problem is I don't know how to write check function. I want a valid string with represent a number like "12345" "489796" ...etc
const handleCheckValue = () => {
setIsValid(false);
if (input === undefined || input === null || input.trim() === "" || isNaN(input)){
setWarnText(warnTextMap["notValid"]);
} else {
setIsValid(true);
}
};
Should I check if it is undefined or null? I googled and searched but can't find an question like this..