Takina · · 5 min read Module Federation Explained: Sharing Code at Runtime
Module Federation lets separately built and deployed JavaScript apps load each other's modules at runtime. How hosts, remotes, and shared dependencies work.
Topic
172 posts tagged “JavaScript”.
Takina · · 5 min read Module Federation lets separately built and deployed JavaScript apps load each other's modules at runtime. How hosts, remotes, and shared dependencies work.
Takina · · 5 min read JavaScript's == converts types before comparing; === does not. How coercion works, the classic gotchas, where Object.is fits, and which to use.
Takina · · 5 min read Promise.withResolvers() returns a promise plus its resolve and reject functions, replacing the deferred pattern. How it works and when to use it.
Takina · · 5 min read JavaScript string length counts UTF-16 code units, not characters. How code units, code points, and grapheme clusters differ and how to handle each.
Chisato · · 5 min read Prototype pollution is a JavaScript vulnerability where attacker input modifies Object.prototype, affecting every object. How it works and how to stop it.
Takina · · 5 min read JavaScript custom error classes and the Error cause option let you throw specific, chainable errors. How to define them, wrap failures, and handle them well.
Takina · · 6 min read Cloudflare is acquiring Deno. Deno Deploy shuts down in six months, the runtime gets one year of fixes, and celld merges into workerd for self-hosted Workers.
Takina · · 5 min read Event bubbling and capturing are the two directions a DOM event travels. How propagation phases work, when to use each, and how to stop them.
Takina · · 6 min read Long tasks block the main thread for 50ms or more and make pages feel frozen. How to split them with yielding, scheduler.yield(), postTask, and workers.
Takina · · 5 min read Passive event listeners tell the browser a handler won't call preventDefault(), so scrolling starts at once. How { passive: true } works and when to use it.
Takina · · 5 min read Code splitting breaks one large JavaScript bundle into smaller chunks loaded on demand. How bundlers do it, the main strategies, and the trade-offs.
Takina · · 5 min read Microtasks (promise callbacks) run before the next macrotask (timers, events). How the two queues are ordered, and why it matters for your code.
Takina · · 5 min read OffscreenCanvas lets you render canvas graphics off the main thread, in a web worker, so heavy drawing work stops blocking scrolling, input, and animation.
Takina · · 5 min read TanStack Query and SWR both cache and revalidate server data in React, but differ in scope, mutation handling, and how much they manage for you.
Takina · · 4 min read The React Compiler automatically memoizes components and values at build time, cutting most manual useMemo, useCallback, and React.memo calls.
Takina · · 4 min read Object.groupBy() buckets array items by a key you compute, replacing the reduce() boilerplate developers have written for years. How it works.
Takina · · 4 min read Structural typing checks shape, not name — TypeScript treats two differently-named types as compatible if their members match, unlike nominal systems.
Takina · · 3 min read Import attributes let JavaScript modules declare a resource's expected type at import time, such as JSON — catching mismatches before code runs.
Takina · · 4 min read The Streams API lets JavaScript process data as chunks arrive instead of buffering it all in memory. How ReadableStream, WritableStream, and pipes work.
Takina · · 4 min read Workspaces let npm and pnpm manage multiple packages in one repository, sharing a single dependency tree and letting packages reference each other locally.
Takina · · 4 min read The Web Locks API lets JavaScript acquire named locks shared across tabs, so only one tab does work like a token refresh or a write at a time.
Chisato · · 4 min read The Trusted Types API blocks DOM-based XSS by forcing risky DOM sinks like innerHTML to accept only vetted objects instead of raw strings.
Takina · · 4 min read Biome is a Rust-based linter and formatter that replaces ESLint and Prettier with one faster tool, one config file, and no plugin ecosystem to manage.
Takina · · 4 min read Svelte 5 runes like $state and $derived replace the old reactive-assignment magic with explicit function calls that work anywhere in a file.
Takina · · 5 min read Variance decides when TypeScript accepts Array<Dog> where Array<Animal> is expected — covariant, contravariant, or invariant, explained with examples.
Takina · · 4 min read A shallow copy duplicates an object's top-level properties but shares nested references; a deep copy duplicates everything recursively. How to do each.
Takina · · 4 min read Canvas draws immediate-mode pixels you redraw yourself; SVG keeps a live, styleable DOM of vector shapes. Here's how to pick between the two.
Takina · · 5 min read toSorted(), toReversed(), toSpliced(), and with() copy an array instead of mutating it, fixing a long-standing footgun in JavaScript's Array API.
Takina · · 3 min read A SharedWorker runs one script shared across every tab and window of the same origin — a single background thread they can all connect to and message.
Takina · · 5 min read Zod infers static TypeScript types directly from its schemas; Yup was built for JavaScript form validation first. How the two approaches differ.
Takina · · 4 min read Bun and Deno both aim to replace Node.js with a faster, more batteries-included runtime. How their runtimes, tooling, and compatibility differ.
Takina · · 5 min read A .d.ts file describes a library's types without its implementation. How TypeScript declaration files work, and how to write one for an untyped JS package.
Takina · · 4 min read A TypeScript tuple is a fixed-length array where each position has its own type. How tuples work, labeled elements, and when to use them over arrays.
Takina · · 5 min read ResizeObserver watches an element's size; IntersectionObserver watches its visibility. Both replace scroll/resize listeners — here's when to use each.
Takina · · 4 min read Most regex engines backtrack through an NFA; a few compile to a DFA instead. The difference explains why some patterns hang forever and others never do.
Takina · · 4 min read JavaScript private class fields use a # prefix to enforce true encapsulation at the language level, hiding state that closures and underscores never could.
Takina · · 4 min read An index signature lets a TypeScript type describe objects whose keys aren't known in advance. How the syntax works, and when to reach for a Record instead.
Takina · · 4 min read JavaScript's iterator helper methods bring map, filter, and take directly to iterators, so lazy sequences no longer need a library or a manual loop.
Takina · · 4 min read JavaScript's Reflect object mirrors fundamental object operations as functions, designed to pair with Proxy traps and simplify metaprogramming.
The Lycoris Team · · 4 min read TypeScript's moduleResolution setting decides how import paths map to files. How node10, node16, and bundler resolution differ, and which to pick.
Takina · · 4 min read The Navigation API gives JavaScript a structured way to intercept and control browser navigations — a modern alternative to the History API.
Takina · · 3 min read Array.sort() converts elements to strings by default, so numbers sort out of order. Here's why, and how a compare function fixes it.
Takina · · 5 min read The BroadcastChannel API lets same-origin tabs, windows, and workers pass messages to each other instantly, with no server round trip or polling.
Takina · · 4 min read useMemo caches a computed value; useCallback caches a function reference. Both skip work on re-render, but they memoize different things.
Takina · · 4 min read React's Context API passes data through the component tree without manually threading props at every level — and where it stops being the right tool.
Takina · · 4 min read setTimeout runs a callback once after a delay; setInterval repeats it on a fixed cadence — but drifts under load in ways setTimeout recursion avoids.
Takina · · 4 min read TypeScript is JavaScript plus a compile-time type system — same runtime, different guarantees. Where each one wins and how they fit together.
Takina · · 3 min read JavaScript's Set object now has built-in union, intersection, difference, and subset methods — replacing manual loops for combining collections.
Takina · · 5 min read Top-level await lets a JavaScript module pause at import time without wrapping code in an async function. How it works and when it bites.
Takina · · 5 min read Hydration re-runs a framework's JS to attach interactivity after render; resumability serializes state so the browser can skip that work.
Takina · · 4 min read Node's cluster module forks whole processes to use every CPU core; worker_threads share memory inside one process. How to pick between them.
Takina · · 5 min read Nx and Turborepo both speed up monorepo builds with caching and task graphs — the real difference is scope, plugins, and how much structure you want.
Takina · · 4 min read Strict mode turns silent JavaScript mistakes into thrown errors and closes off unsafe legacy behavior. Modules and classes use it by default.
Takina · · 4 min read BigInt is JavaScript's built-in type for whole numbers beyond Number's safe limit. How the syntax works, what it can't do, and when you actually need it.
Takina · · 4 min read esbuild, Rollup, and webpack all bundle JavaScript, but trade off speed, configurability, and output shape differently. Which fits which project.
Takina · · 4 min read JavaScript frees memory automatically by tracking reachability, not reference counts. How the mark-and-sweep algorithm works and what causes leaks anyway.
Takina · · 4 min read requestAnimationFrame schedules work right before the next repaint; requestIdleCallback runs only when the browser is otherwise idle. When to use each one.
Takina · · 4 min read Node's Buffer class holds raw binary data outside the V8 heap, letting Node handle files, sockets, and streams efficiently. Here's how it works.
Takina · · 4 min read ArrayBuffer allocates raw binary memory; typed arrays like Uint8Array give it a numeric type and view. How JavaScript handles binary data directly.
Takina · · 4 min read Deno vs Node.js compared: security model, TypeScript support, module resolution, and when each runtime is the better choice.
Takina · · 5 min read Hoisting moves variable and function declarations to the top of their scope before code runs, which explains some of JavaScript's most confusing bugs.
Takina · · 4 min read Node.js worker threads run JavaScript on real OS threads in parallel, letting CPU-heavy work run without blocking the event loop.
Takina · · 4 min read The URL API parses, builds, and validates URLs natively in JavaScript — no regex needed. How URL and URLSearchParams work, with practical examples.
Takina · · 4 min read The Clipboard API lets web pages read and write the system clipboard asynchronously, replacing the old execCommand copy/paste hacks with a real API.
Takina · · 4 min read The Web Share API lets a web page open the device's native share sheet to send text, links, or files to other apps, no clipboard hack required.
Takina · · 5 min read Virtual scrolling renders only the rows visible in the viewport, keeping the DOM small so lists with tens of thousands of items stay smooth.
Takina · · 4 min read Remix and Next.js both extend React with routing and data loading, but differ sharply in rendering model, data fetching, and deployment targets.
The Lycoris Team · · 4 min read Vitest and Jest share a similar API, but Vitest's Vite-based architecture makes it faster with native ESM. How the two test runners compare.
Takina · · 3 min read The Web Animations API lets JavaScript create and control animations natively, combining CSS-animation performance with imperative, scriptable control.
Takina · · 4 min read The MutationObserver API watches for changes to the DOM — attributes, child nodes, and text — without polling. How it works and when to use it.
Takina · · 3 min read SharedArrayBuffer lets JS threads share raw memory; Atomics provides race-free operations on it. How true multi-threaded data sharing works in JS.
Takina · · 4 min read A polyfill is code that implements a missing browser feature so older environments behave as if they supported it natively.
The Lycoris Team · · 4 min read Tail call optimization reuses a function's stack frame for its final call instead of pushing a new one, turning some recursion into constant stack space.
Takina · · 5 min read Branded types attach a compile-time-only tag to a primitive so TypeScript rejects mixing values that share a shape but not a meaning.
Takina · · 4 min read flat() flattens nested arrays by a given depth; flatMap() maps then flattens one level in a single pass. How each works and when to pick one.
Takina · · 4 min read The History API lets JavaScript change the URL and manage browser history without a page reload, which is what makes client-side routing possible.
Takina · · 4 min read Zustand is a minimal hook-based store with almost no boilerplate; Redux is a stricter, more structured pattern built for large, predictable state trees.
Takina · · 4 min read Declaration merging lets TypeScript combine multiple declarations of the same name into one — the mechanism behind extending interfaces and global types.
Takina · · 4 min read The App Router uses React Server Components and nested layouts; the Pages Router is Next.js's original file-based model. How they differ and when to pick each.
Takina · · 4 min read Object.freeze() locks an object completely; Object.seal() only stops adding or removing properties. How the two immutability methods differ.
Takina · · 4 min read Abstract classes in TypeScript define shared implementation plus methods subclasses must fill in. How they differ from interfaces and when to reach for them.
Takina · · 3 min read React Suspense lets components pause rendering while they wait on async data, showing a fallback UI instead of manual loading-state juggling.
Takina · · 4 min read The Page Visibility API tells JavaScript when a tab is hidden or visible, so you can pause polling, animations, and timers the user can't see.
Takina · · 4 min read A lockfile records the exact dependency versions your package manager resolved, so every install — from your laptop to CI — reproduces the same tree.
Takina · · 3 min read never represents values that can't exist — it marks unreachable code, exhaustive switches, and functions that always throw or loop forever.
Takina · · 4 min read TypeScript's readonly keyword blocks reassignment at compile time for properties, arrays, and tuples — with no runtime enforcement at all.
Takina · · 4 min read The Intl API formats dates, numbers, and currency using a user's locale without a library. How Intl.DateTimeFormat and Intl.NumberFormat work.
Takina · · 4 min read requestIdleCallback runs low-priority JavaScript when the browser is idle, without blocking rendering, input, or the main thread.
Takina · · 5 min read Turbopack is a Rust-based bundler built for incremental speed; Webpack is the mature, plugin-heavy standard. How they differ and when to pick each.
Takina · · 5 min read Promise.all() fails fast, allSettled() waits for every result, and race() returns whichever promise finishes first — how to choose correctly.
Takina · · 4 min read JavaScript's dynamic import() loads a module on demand and returns a promise, letting you split bundles and defer code until it's actually needed.
Takina · · 4 min read The spread operator (...) expands an iterable into individual elements; the rest operator collects elements back into an array. Same syntax, opposite jobs.
Takina · · 4 min read TypeScript's as const assertion locks a value to its literal, readonly type instead of widening it. How it works and when to reach for it.
Takina · · 4 min read The ResizeObserver API lets JavaScript watch an element's box size and react without polling or resize-event hacks. How it works and when to use it.
Takina · · 5 min read A JavaScript memory leak happens when a reference outlives its usefulness and the garbage collector can't reclaim it. Common causes and how to find them.
Takina · · 4 min read localStorage, sessionStorage, and cookies all store data in the browser, but differ in lifetime, size limits, and whether the server can see them.
Takina · · 4 min read Import maps let browsers resolve bare module specifiers like "react" to real URLs, enabling native ES module imports without a bundler.
Takina · · 5 min read The Push API lets a web app send notifications through a service worker, even when the site isn't open in a browser tab. Here's the full flow.
Takina · · 5 min read JavaScript destructuring unpacks values from arrays and objects into variables in one expression. How it works, with the rest and spread operators.
Takina · · 4 min read How JavaScript determines what this refers to: default, implicit, explicit, and new binding, plus why arrow functions behave differently.
The Lycoris Team · · 4 min read A monad is a wrapper type with rules for chaining operations that might fail, be async, or carry extra context — like Promise or Optional, generalized.
Takina · · 5 min read Type guards are functions and checks that narrow a TypeScript union to a specific type at runtime. How typeof, instanceof, in, and custom guards work.
Takina · · 4 min read TypeScript function overloads let one function name accept multiple call signatures with different types. How overload signatures work and when to use them.
Takina · · 4 min read Tagged template literals let a function intercept a template string's parts before interpolation — the mechanism behind safe SQL, styled-components, and i18n.
Takina · · 5 min read IndexedDB is a browser API for storing large amounts of structured data client-side, with indexes, transactions, and no size limit like localStorage.
Takina · · 4 min read Event delegation attaches one listener to a parent instead of one per child, using event bubbling to catch clicks from elements added after page load.
Takina · · 4 min read The Intersection Observer API tells you when an element enters or leaves the viewport, without scroll-event polling. How it works and where to use it.
Takina · · 4 min read structuredClone() is a built-in JavaScript function for deep-copying values, including cycles and typed arrays, without the workarounds JSON tricks require.
Takina · · 4 min read tsconfig.json controls how TypeScript checks and compiles your code. Here are the options that actually change behavior, and the ones you can leave alone.
Takina · · 4 min read Template literal types let TypeScript build string types from other types, like JavaScript template strings. How they work, with practical patterns.
Takina · · 4 min read The Fetch API is JavaScript's built-in interface for making HTTP requests. How it works, its promise-based flow, and where it trips people up.
Takina · · 4 min read TypeScript's interface and type both describe object shapes, but they diverge on declaration merging, unions, and extension. When to reach for each.
Takina · · 4 min read requestAnimationFrame schedules a callback right before the browser repaints, syncing JavaScript animation to the display's refresh rate. How it works.
Takina · · 4 min read Solid.js uses fine-grained signals and no virtual DOM; React re-renders components and diffs. How the two reactivity models differ in practice.
Takina · · 5 min read SSE streams one-way updates over plain HTTP; WebSockets open a full-duplex channel. How they differ and which fits your real-time feature.
Takina · · 4 min read Mapped types transform one type into another by iterating over its keys — the mechanism behind Partial, Readonly, Record, and Pick under the hood.
Takina · · 4 min read TypeScript enums group named constants under one type. How numeric, string, and const enums compile, and when a union type is the better choice.
Takina · · 4 min read A JavaScript Symbol is a guaranteed-unique primitive used for collision-free object keys. How Symbols work, well-known Symbols, and when to use them.
Takina · · 4 min read A discriminated union tags each variant of a type with a shared literal field, letting TypeScript narrow the type automatically inside a switch or if check.
Takina · · 4 min read var, let, and const differ in scope, hoisting behavior, and reassignment rules. Here's what each one actually does and when to reach for it.
Takina · · 4 min read ESLint catches bugs and enforces code patterns; Prettier only reformats how code looks. Why most JavaScript projects run both, not one or the other.
Takina · · 4 min read Optional chaining (?.) short-circuits on null or undefined instead of throwing; nullish coalescing (??) supplies a default only for null or undefined.
Takina · · 4 min read Prototypal inheritance means JavaScript objects inherit properties directly from other objects via a prototype chain, not from classes. How it works.
Takina · · 4 min read Web workers run scripts off the main thread for parallel computation. Service workers intercept network requests for offline and caching. How they differ.
Takina · · 4 min read map, filter, and reduce transform arrays without loops or mutation. How each one works, when to reach for it, and where they trip people up.
Takina · · 4 min read TypeScript's unknown forces a type check before use; any opts out of type checking entirely. When to reach for each in real code.
Takina · · 4 min read A source map is a file that maps minified, bundled, or transpiled code back to its original source, so debuggers and stack traces stay readable.
Takina · · 4 min read Conditional types let TypeScript pick a type based on another type, using T extends U ? X : Y — the foundation of most advanced type utilities.
Takina · · 3 min read Currying transforms a multi-argument function into a chain of single-argument functions. How currying and partial application work in JavaScript.
Takina · · 4 min read Vue uses a template syntax with a reactive proxy system; React uses JSX with a virtual DOM. How the two frameworks differ and when to pick each.
Takina · · 4 min read Node.js streams process data in chunks instead of loading it all into memory. How readable, writable, and transform streams work, and when to reach for them.
Takina · · 5 min read A WeakMap holds object keys without blocking garbage collection, unlike a regular Map. How WeakMap and WeakRef work and when to reach for them.
Takina · · 4 min read JavaScript's Map and Set are built-in collections with cleaner semantics than plain objects and arrays. Here's how each works and when to reach for one.
Takina · · 4 min read The Temporal API is JavaScript's built-in replacement for Date — immutable, timezone-aware objects for dates, times, and durations.
Takina · · 4 min read TypeScript's satisfies operator checks a value against a type without widening or erasing its inferred literal type. Here's when to reach for it.
Takina · · 4 min read TypeScript decorators attach reusable behavior to classes and members with an @ syntax. How class, method, and field decorators work, with real examples.
Takina · · 4 min read Shadow DOM attaches an isolated DOM tree to an element so a component's styles and markup can't leak in or out. Here's how it actually works.
Takina · · 4 min read npm, pnpm, and Yarn all install the same packages but differ in speed, disk usage, and monorepo support. Here's how to pick the right one.
Takina · · 4 min read AbortController lets JavaScript cancel an in-flight fetch or async task on demand, preventing stale responses from overwriting newer state.
Takina · · 5 min read ESM and CommonJS are JavaScript's two module systems — how import/export differs from require/module.exports, and when each one is used.
Chisato · · 3 min read Cross-site scripting (XSS) injects malicious scripts into pages other users view. How stored, reflected, and DOM-based XSS work, and how to prevent them.
Takina · · 4 min read Optimistic UI updates the interface immediately, before the server confirms a change, then rolls back if the request fails — for apps that feel instant.
Takina · · 4 min read Web Components are browser-native APIs for building reusable, encapsulated custom elements that work in any framework, or none at all.
Takina · · 4 min read TypeScript utility types like Partial, Pick, Omit, and Record transform existing types instead of redeclaring them. How the common ones work, with examples.
Takina · · 4 min read A monorepo holds multiple projects in one repository with shared tooling and atomic commits. How it compares to splitting projects across separate repos.
Takina · · 4 min read Generators are functions that pause and resume with the yield keyword, producing values lazily on demand instead of computing them all at once.
The Lycoris Team · · 4 min read Memoization caches a function's return value by its input, skipping recomputation on repeat calls. How it works and when it actually helps.
Takina · · 4 min read TypeScript generics let functions and types work with any type while preserving the specific type used at each call site, avoiding both duplication and any.
Takina · · 4 min read Async/await is syntactic sugar over Promises, not a different mechanism. How each looks in practice, and when to still reach for raw Promises.
Takina · · 4 min read The virtual DOM is an in-memory copy of the UI tree that frameworks diff against the previous version to batch and minimize real DOM updates.
Chisato · · 4 min read A Content Security Policy is an HTTP header that restricts what scripts and resources a page can load, blocking most XSS attacks by default.
Takina · · 4 min read A JavaScript Proxy wraps an object and intercepts operations like get and set through traps. How traps work, with practical examples and Reflect.
Takina · · 4 min read A web worker runs JavaScript on a background thread, freeing the main thread to keep the UI responsive. How workers communicate and when to use one.
Takina · · 5 min read Svelte compiles away at build time; React ships a runtime and virtual DOM. Bundle size, reactivity model, and ecosystem tradeoffs compared.
Takina · · 5 min read Microsoft shipped TypeScript 7.0 with a Go-native compiler that's roughly 10x faster than 6.0. What changed, what breaks, and how to upgrade.
Takina · · 4 min read Tree shaking removes unused exports from a JavaScript bundle at build time, shrinking file size by relying on ES module static structure.
Takina · · 5 min read A JavaScript closure is a function that remembers the variables from where it was defined. How closures work, why they matter, and the classic loop gotcha.
Takina · · 5 min read Debounce and throttle both tame rapid-fire events, but differently — debounce waits for a pause, throttle enforces a steady rate. When to use each.
Takina · · 3 min read htmx lets you build dynamic, interactive pages with HTML attributes — no SPA, no build step. Learn the core ideas and ship a working live-search example in minutes.
Takina · · 4 min read WebRTC lets browsers stream audio, video, and data directly between peers — no plugins. How getUserMedia, RTCPeerConnection, and ICE/STUN/TURN fit together.
Takina · · 5 min read Static sites don't need a search server. Learn how Pagefind indexes your HTML at build time and adds fast, client-side full-text search for free.
Takina · · 4 min read A WebSocket is a protocol for full-duplex, persistent communication over a single TCP connection. Learn how it works, when to use it, and what the alternatives are.
Takina · · 4 min read CORS lets a server opt in to cross-origin browser requests, relaxing the same-origin policy in a controlled way. Why it exists and how to fix CORS errors.
Takina · · 4 min read JavaScript is single-threaded, yet pages stay responsive. A clear tour of the call stack, task queue, and microtasks — with examples you can run.
Takina · · 5 min read Signals offer fine-grained reactivity with automatic dependency tracking — and nearly every major framework has adopted them. Here's why the model won.
Takina · · 4 min read The View Transitions API brings smooth, app-like transitions to the web without a heavy SPA framework. Here's how it works and how to use it today.
Takina · · 5 min read An honest comparison of Bun and Node.js in 2026 — speed, ecosystem, built-in tooling, and when each runtime actually wins.
Takina · · 3 min read JavaScript is the programming language that makes web pages interactive. Learn how it works alongside HTML and CSS, and why it runs nearly everywhere.
Takina · · 5 min read React Server Components render exclusively on the server and stream a serialized result — no client JS shipped for that component. Here's what that actually means.
Takina · · 4 min read The DOM is the live in-memory tree browsers build from your HTML, which JavaScript reads and manipulates. Learn how it works and why it matters.
Takina · · 3 min read TypeScript adds a safety net to JavaScript without slowing you down. Here's how to set it up, the handful of concepts that matter, and how to adopt it gradually.
Takina · · 4 min read Server-Sent Events stream real-time updates over a single HTTP connection. How SSE works, when to use it, and how it compares to WebSockets.