Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

async await useeffect react

const [users, setUsers] = useState([]);
  
useffect(() => {
  const getUsers = async () => {
    let response = await fetch('/users');
    let data = await response.json();
    setUsers(data);
  };
    
 getUsers();
}, []);
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #async #await #useeffect #react
ADD COMMENT
Topic
Name
1+1 =