I try to fetch some data from the https://randomuser.me/api/ . I wanna take an random user gender but i don't know why my function doesn't do it and i get this error "Cannot read property '0' of undefined"
My code:
const [fetchData, setFetchData] = useState('');
fetch('https://randomuser.me/api/')
.then((response) => response.json())
.then(setFetchData)
.then(console.log(fetchData.results[0].gender));