Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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();
}, []);
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #useeffect #async #await
ADD COMMENT
Topic
Name
2+7 =