Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

await useeffect javascript

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: #await #useeffect #javascript
ADD COMMENT
Topic
Name
9+2 =