Skip to content

Instantly share code, notes, and snippets.

View dylan-albertazzi's full-sized avatar
🎯
Focusing

Dylan Albertazzi dylan-albertazzi

🎯
Focusing
View GitHub Profile
@dylan-albertazzi
dylan-albertazzi / useEffect-Async-TheRightWay.js
Created July 20, 2021 02:04
Stop useEffect Hook React re-render multiple times with Async Await | Dylan Albertazzi YouTube
import React, { useState, useEffect } from "react";
function App() {
const [value, setValue] = useState("");
//Waits for a period of time then resolves
function timeout(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}