AZ.dev

Developer Reference

Opinionated micro-docs. One right answer. Copy-paste ready.

Categories

Recently Added

Fix "Cannot find module" with ES modules in Node.js
Node.js Node.js ES modules require explicit file extensions in import paths.
Undo the last commit but keep the changes
Git Reset the last commit while keeping all changes staged and ready to re-commit.
Array reduce: sum values and transform objects
JavaScript Array.reduce() iterates an array and accumulates a single result.
Why useEffect runs twice in development and how to write it so that's fine
React In development, Strict Mode mounts each component, unmounts it, and mounts it again, so an effect runs, cleans up, and runs once more.
Stash work in progress including new, untracked files
Git git stash alone leaves new files behind.
Check an object against a type without losing its literal types
TypeScript Use satisfies when you want the compiler to check a value against a type but keep the narrower type it inferred.
Run a TypeScript file with node and no build step
Node.js Current Node runs .ts files by stripping the type annotations.
Reset a component's state when the thing it shows changes
React Give the component a key tied to its subject.
Fail a Node script without cutting off its output
Node.js Set process.exitCode and let the script end on its own.
Why position sticky isn't sticking
CSS & Layout A sticky element needs an inset and a scrolling ancestor with no overflow other than visible in between.