It is documented alongside DOM access and its more interesting property is that it is a mutable container whose identity survives every render and whose changes do not…
A hook cannot be called outside a component, so testing one used to mean building a throwaway component and asserting on what it rendered — which tests the…
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…
Hooks are matched to their state by call order, so calling one conditionally shifts every subsequent hook onto the wrong slot — and the failure is data appearing…
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…
A hook cannot be called outside a component, so testing one used to mean building a throwaway component and asserting on what it rendered. act is what flushes…
A failing snapshot is regenerated with -u, and after the third time that becomes reflex — at which point the test asserts that the output equals whatever the…