const loadUser = async () => {
try {
const response = await users.getUsersById();
if (!response.ok) return console.log("Error");
usersId = response.data
var count = 0
console.log(usersId)
while (count != usersId.lenght - 1) {
if (usersId[count].id == userId) {
setUserFound(true)
setUser(usersId[count].name)
console.log(usersId[count].id)
}
count++
}
} catch (error) {
console.log(error)
}
};
And the error showing is as follows
undefined is not an object (evaluating 'usersId[count].id')