i am trying to run this code and getting error my code is as below in this useState hook i have a array and i am trying to loop through it but only thing i am getting is error
import React, { useState } from "react";
const LoadAllUser = () => {
const [users, setUsers] = useState([
{
name: "Bhoomit",
email: "bhumit070@gmail.com",
},
{
name: "Bhopu",
email: "bhopu@gmail.com",
},
{
name: "sameer",
email: "sam@gmail.com",
},
]);
return (
<div>
{users !== undefined && users.length > 0 ? (
users.map((index, user) => {
return (
<div className="" key={index}>
{user.name} <br />
{user.email} <br />
</div>
);
})
) : (
<h1> No users found </h1>
)}
</div>
);
};
export default LoadAllUser;