Skip to content
tezvyn:

All bites

The whole library, newest first. Filter by what you are here for, or pick a topic if you already know.

8668 bites

Page 245

Svelte's `bind:`: Two-Way Data Binding Made Simple
Vue, Angular & Svelte2 min read

Svelte's `bind:`: Two-Way Data Binding Made Simple

Svelte's bind: turns one-way data flow into a two-way street, letting child elements update parent state. It's essential for syncing form inputs without manual event handlers. The footgun: an invalid number input yields undefined, not 0.

Container vs. Presentational: A Component Separation Pattern
Vue, Angular & Svelte2 min read

Container vs. Presentational: A Component Separation Pattern

Split components into 'smart' containers that handle data and logic, and 'dumb' presentational components that just render UI. This lets you reuse state across different views, like showing a product list in a grid or a table.

Angular Schematics: Automating Code Modification Safely
Vue, Angular & Svelte2 min read

Angular Schematics: Automating Code Modification Safely

Think of a schematic as a safe, scriptable code generator. It operates on a virtual copy of your project, applying changes only after verifying the entire operation. Use them to enforce conventions or package library code.

Module Federation: The Multi-Framework "Hydra"
Vue, Angular & Svelte2 min read

Module Federation: The Multi-Framework "Hydra"

Module Federation can unite micro frontends from different frameworks (e.g., Angular, React) in one app. This is a last resort for migrations or integrating legacy code, not a standard pattern, as it increases complexity and bundle size.

Angular's angular.json: Your Workspace Blueprint
Vue, Angular & Svelte1 min read

Angular's angular.json: Your Workspace Blueprint

angular.json is the blueprint for your workspace, telling the CLI how to build, serve, and generate code. It defines project paths, build targets, and default prefixes. The footgun: assuming the projects section mirrors the file system.

ng generate: Your Project's Code Wizard
Vue, Angular & Svelte2 min read

ng generate: Your Project's Code Wizard

ng generate is a command-line wizard for scaffolding new Angular features. It doesn't just create files; it wires them into your app. Use ng g component my-component to create components, services, and more.

Svelte's Reactivity: A Compiler, Not a Library
Vue, Angular & Svelte2 min read

Svelte's Reactivity: A Compiler, Not a Library

Svelte achieves reactivity at compile time, not runtime. It's a compiler that turns your component files into efficient, imperative JavaScript that updates the DOM directly, skipping the virtual DOM. The footgun: reactivity only triggers on assignment.

Angular's Default Change Detection with Zone.js
Vue, Angular & Svelte2 min read

Angular's Default Change Detection with Zone.js

Zone.js tells Angular to re-check your entire app whenever any async event finishes. This is Angular's default magic: a variable updates after an HTTP call, and the UI just works. The footgun? This "check everything" approach is expensive in large apps.

Angular NgModules: Organizing Legacy Code
Vue, Angular & Svelte1 min read

Angular NgModules: Organizing Legacy Code

Think of an NgModule as a shipping container for related features, bundling components, directives, and pipes. You'll find them organizing code in older Angular apps.

Vue, Angular & Svelte2 min read

ISR: Static Speed for Dynamic Content

Incremental Static Regeneration (ISR) gives users a fast, static page while regenerating it in the background. It's ideal for e-commerce catalogs or blogs that update periodically.

SvelteKit Server-Only Modules: Keep Your Secrets Secret
Vue, Angular & Svelte2 min read

SvelteKit Server-Only Modules: Keep Your Secrets Secret

SvelteKit's server-only modules are a firewall for your code, preventing sensitive data like API keys from ever being bundled for the browser. Use them for database clients or secret logic.

SvelteKit Prerendering: Build-Time HTML for Faster Sites
Vue, Angular & Svelte2 min read

SvelteKit Prerendering: Build-Time HTML for Faster Sites

SvelteKit prerendering creates static HTML files at build time for instant loads. It's ideal for content that doesn't change per user, like marketing pages or blog posts. The main footgun: unlinked pages won't be found unless you explicitly list them.

Angular: Run Code Only on Browser or Server
Vue, Angular & Svelte2 min read

Angular: Run Code Only on Browser or Server

Angular Universal runs your app twice: on a server and in a browser. Use isPlatformBrowser to run code only where it's safe, like accessing window or document, to prevent your server-side render from crashing.

Angular TransferState: Avoid Double Data Fetching in SSR
Vue, Angular & Svelte2 min read

Angular TransferState: Avoid Double Data Fetching in SSR

TransferState is a key-value cache that bridges your Angular SSR server and the browser, preventing the client from re-fetching data the server already got. Use it to pass resolved API data from the server render to the client, avoiding wasted network calls.

Vue, Angular & Svelte2 min read

Nuxt Server Data Fetching: useAsyncData & useFetch

Avoid client-side request waterfalls by fetching data on the server and embedding it in the page. Nuxt's useAsyncData and useFetch handle this SSR hydration for you. The main footgun: not providing a stable key, leading to re-fetches.

Universal Rendering: Server-First, Client-Interactive
Vue, Angular & Svelte2 min read

Universal Rendering: Server-First, Client-Interactive

Universal Rendering sends a pre-built HTML page from the server for a fast load, then adds interactivity on the client. It's the default in frameworks like Nuxt for better SEO, but the footgun is writing code that crashes on the server by assuming a browser.

Vue, Angular & Svelte2 min read

Static Site Generation: Pre-built Pages for Speed & Simplicity

Static Site Generation (SSG) pre-builds every page of your site into static HTML files, instead of generating them on-demand. This makes sites incredibly fast and cheap to host on a CDN, perfect for blogs or docs. The footgun: build times grow with site size.

Vue, Angular & Svelte2 min read

Server-Side Rendering: Your App's First Paint Matters

Server-Side Rendering (SSR) sends a fully-formed HTML page from the server, not a blank one. This speeds up the first paint and helps SEO. The footgun is assuming it's always faster; it increases server load and can delay interactivity.

Angular Incremental Compilation: Faster Rebuilds
Vue, Angular & Svelte2 min read

Angular Incremental Compilation: Faster Rebuilds

Angular's incremental compilation avoids full rebuilds by tracking changes, making performance proportional to what you changed, not the whole app. It speeds up development by reusing analysis and skipping file generation for unchanged code.

Framework Reactivity: Coarse vs. Fine-Grained Updates
Vue, Angular & Svelte2 min read

Framework Reactivity: Coarse vs. Fine-Grained Updates

Frameworks sync UI and state differently. Coarse-grained systems like React re-run component code, while fine-grained systems like Vue (Proxies) or Angular (Signals) track dependencies to update only what's needed.