Skip to content

Instantly share code, notes, and snippets.

View majidux's full-sized avatar
🎯
Focusing

Majid Darvishnejad majidux

🎯
Focusing
View GitHub Profile

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@buglessir
buglessir / react-memory-leaks.js
Created February 20, 2022 09:12
3 ways to fix Memory Leaks in React web application
// 1) Using Boolean flag:
const [value, setValue] = useState('');
useEffect(() => {
let isMounted = true;
fetchValue().then(() => {
if (isMounted) {
setValue('done!'); // no more error
}
});