Zhenghao He
zhenghao.io · Personal blog · on HN since 2022
Zhenghao He is a front-end engineer who writes about React, JavaScript and TypeScript, plus system design interviews.
What HN saysHN commenters point to his posts on React memoization and system design interviews, and recommend the site to people interested in JavaScript, TypeScript and web development.
15HN people shared it
5linked it in comments
18stories submitted
381story points
4 years agolast shared
2022people per year2026
Most-shared posts
- 1Preemptive memoization in React is probably not Evil (yet)4 people · 9 points · first shared 2022 · discussion on HN
- 2When You Should Prefer Map over Object in JavaScript3 people · 6 points · first shared 2022 · discussion on HN
- 3Front End vs. Back End System Design Interviews3 people · 1 points · first shared 2022 · 1 comments on HN
- 4When Does React Render Your Component?2 people · 4 points · first shared 2022 · discussion on HN
- 5The Double-Assignment Pattern in jQuery's Source Code2 people · 4 points · first shared 2022 · discussion on HN
- 6Front End vs. Back End System Design Interviews2 people · 2 points · first shared 2022 · discussion on HN
- 7An introduction to type programming in TypeScript1 people · 148 points · first shared 2022 · 65 comments on HN
- 8A complete guide to TypeScript’s 'never' type1 people · 95 points · first shared 2022 · 63 comments on HN
- 9Include debugging in the interview process1 people · 67 points · first shared 2022 · 16 comments on HN
- 10Type Polymorphic Functions in TypeScript1 people · 37 points · first shared 2022 · 14 comments on HN
- 11JSON and the Stringification Oddities in JavaScript1 people · 4 points · first shared 2022 · discussion on HN
- 12The type hierarchy tree in TypeScript1 people · 2 points · first shared 2022 · discussion on HN
- 13Detect JavaScript Memory Leaks with QueryObjects1 people · 2 points · first shared 2022 · discussion on HN
What HN people wrote when they linked it
acemarke · 2022-07-05
I would strongly suggest reading through my extensive post "A (Mostly) Complete Guide to React Rendering Behavior" [0], which walks through what "rendering" actually is, what triggers it, React's default behavior, and ways to optimize the behavior by skipping renders for certain components. The post "When Does React Render Your Component?" [1] is also excellent.
The short summary is that React queues a render when you call some form of `setState()`, renders this component, and by default recursively renders all children inside this component too. Everything else is variations on that idea.
[0] https://blog.isquaredsoftware.com/2020/05/blogged-answers-a-mostly-com…
[1] https://www.zhenghao.io/posts/react-rerender
Pr0ject217 · 2022-02-07
EDIT:
Paste this hacky snippet into your browser's console to save all of the links into your clipboard:
(() =>
{
let result = [...document.querySelectorAll('td a')]
.map((link) =>
link &&
!link.href.includes('ycombinator') &&
!link.href.includes('javascript:void')
? link.href
: ''
)
.filter(Boolean);
result = [...new Set(result)];
result.sort();
copy(result.join('\n\n'));
})();
Just to help, here's a compiled-list of all of the links shared here so…
gururu · 2022-02-07
Me, myself: https://www.zhenghao.io/
Check it out if you are interested in JavaScript, TypeScript, or web development in general
Etheryte · 2022-01-17
It looks like you submitted the wrong link judging by the title, did you mean https://www.zhenghao.io/posts/system-design-interviews instead ?
andrewingram · 2022-03-21
That's why a number of people (myself included) advocate for overzealous/defensive use of useMemo/useCallback as a means of ensuring that a prop changing is always meaningful. The rationale is summarised here: https://www.zhenghao.io/posts/memo-or-not
There are good reasons for _not_ doing this, since using these hooks isn't free; and technically speaking useMemo isn't an identity guarantee (though it currently behaves as one), but I haven't experienced any of the common useEffect pitfalls since adopting this methodology a couple of years ago.
But as my sibling comment points out, a lot of the need for this defensive coding would go away if there were more ways of defining equivalence. I hope that one day the record and tuple proposals land, which should help a bit. But i'd also like to see something like Python's __eq__ and __hash__ in JavaScript too - perhaps done in a similar way to [Symbol.iterator].