how to use hooks with async react code example
Example: useeffect async await
const getUsers = async () => {
const users = await axios.get('https://randomuser.me/api/?page=1&results=10&nat=us');
setUsers(users.data.results);
};
useEffect(() => {
getUsers();
}, []);