Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

async setstate useeffect

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 #setstate #useeffect
ADD COMMENT
Topic
Name
5+6 =