Hi the following code renders the retrieved array 4 times in the console. It seems to me that in the development version this is normal behavior due to StrictMode. Am I right?
import {useState, useEffect} from 'react';
const ExternalData = () => {
const [users, setUsers] = useState([])
useEffect(()=> {
fetch("https://jsonplaceholder.typicode.com/users")
.then((res)=>res.json())
.then((users)=>setUsers(users))
},[])
console.log(users);
return (
<ul>
{users.map(item=><li key={item.id}>{item.name}</li>)}
</ul>
)
}
export default ExternalData;