Assorted web dev tidbits

Replacement of Python's SimpleHTTPServer

Vite can be used as a quick (and better!) replacement for python -m http.server 5173.
npx vite
in any folder, and get a http server that serves the HTML in that directory with live reloads on changes.

Vite DEBUG

Use DEBUG=vite:* vite to get Vite to talk more.

When does React render a component?

  1. React will render a component iff its state changes.
    Context is state.
  2. When React renders a component, it will also render all its children.
    To opt a child out of this, memo it, or pass it as a prop.

Updating package.json

npx npm-check-updates --interactive

updates package.json, not just the lock files. To update just a specific package,

npx npm-check-updates --interactive <package-name>

Colorful diffs of arbitrary files

git diff --no-index b/oo f/ar