Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react useeffect async 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: #react #useeffect #async #javascript
ADD COMMENT
Topic
Name
8+9 =