An effect with an empty dependency array captures the first render’s variables permanently, so a timer set up once reads values that stopped being current seconds later. This…
A memoised component skips re-rendering when its props are shallowly equal, and an inline object or array literal is a new reference on every parent render. The wrapper…
this.setState merges the object you pass into the existing state. The setter from useState replaces the value entirely, which is a silent behaviour change for anyone translating a…
A catch that does not use the error still had to name a variable, which every linter then flagged as unused. Small and genuinely useful for feature detection…
Memoising a callback stops it changing identity between renders, which only matters if something downstream is comparing identities — and by default nothing is. The two have to…
Flattening an array was [].concat(…arrays), which works for one level and reads like a trick rather than an operation. The default depth of one catches people who expect…
Getting every match with capture groups meant a while loop over regex.exec, mutating lastIndex, with an infinite loop waiting for anyone who forgets the g flag. Throwing on…
Four useState calls whose setters are always called together are a state machine written as four independent variables, and every transition has to remember all four. The transitions…
The same card markup in nineteen templates, each subtly different. A CSS framework gives you classes, not components — and the gap is a macro per component.