I am trying to check if the value in the input is Array.
This is working great if the input is an array, but if the input is not an array, I get JSON errors: Uncaught SyntaxError: Unexpected token s in JSON at position 0
Any other solutions that won't throw errors and keep the code working so if it's a different input I can render something else?
function App() {
const [input, setinput] = React.useState("");
const handleSubmit = (event) => {
event.preventDefault();
let parsed = JSON.parse(input);
let condition = Array.isArray(parsed);
if(condition === true){
console.log('working')
}