Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

async react setstate

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