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.

8664 bites

Page 5

TypeScript & Web APIs1 min read

First compilerOptions to set after tsc --init

Enable strict for full type safety, set target and module to match the runtime, and choose outDir/rootDir or moduleResolution; each tightens checks or aligns output.

TypeScript & Web APIs2 min read

WebRTC signaling: SDP, ICE, and the signaling server

Peers exchange SDP offer and answer describing media via an out-of-band signaling server, then trade ICE candidates to find a network path using STUN and TURN.

TypeScript & Web APIs2 min read

Dedicated vs Shared vs Service Workers compared

Dedicated worker serves one page for offloading CPU; Shared worker is one instance across same-origin contexts via ports; Service worker is a network proxy for caching and push, event-driven and killable.

TypeScript & Web APIs1 min read

Generic merge with an intersection return type

Use two type parameters T and U, return T & U, spread both objects; note later spread wins on key collisions and the type may not reflect that.

TypeScript & Web APIs1 min read

Promise .catch() versus async/await try...catch

.catch() handles rejection for all preceding chain steps and reads functionally; try/catch reads synchronously and can scope errors per await, but only catches awaited rejections.

TypeScript & Web APIs1 min read

Implementing the Singleton pattern in TypeScript

Private constructor blocks new, a static private instance field caches it, static getInstance lazily creates and returns the one instance.

TypeScript & Web APIs1 min read

Understanding this in TypeScript

In TypeScript, this is determined by how a function is called, not where it is defined; arrow functions capture the enclosing this lexically, and TypeScript adds optional this parameters to type-check the expected context at compile time.

React & Next.js1 min read

Purpose of Outlet in React Router v6 nested routes

Outlet renders the matched child route inside a parent layout, enabling shared chrome with swappable content; configure nested routes and place Outlet where children render.

React & Next.js1 min read

Tearing and useSyncExternalStore in concurrent React

Tearing is inconsistent UI when an interruptible render reads a changed external store mid-pass; useSyncExternalStore subscribes and forces consistent snapshots, re-rendering synchronously on change.

React & Next.js1 min read

Session auth in Next.js with API routes and middleware

Login route sets a signed httpOnly cookie, middleware validates the session at the edge and redirects, server components read the session.

React & Next.js1 min read

localStorage vs httpOnly cookie for auth tokens

LocalStorage is JS-readable so XSS steals it; httpOnly cookies are JS-invisible blocking XSS theft but exposed to CSRF, mitigated by SameSite and tokens.

React & Next.js1 min read

Testing a component that consumes React Context

Render inside the Context.Provider with a value, or omit it to exercise the default; use a custom render wrapper for reuse.

React & Next.js1 min read

Runtime CSS-in-JS performance pitfalls in SSR Next.js

Runtime libs serialize styles per render, need style collection on the server, risk FOUC and double work in App Router.

React & Next.js1 min read

What is JSX and how does the browser run it?

JSX is XML-like syntax compiled to React.createElement calls; it differs from HTML via className and camelCase; browsers never see JSX, only transpiled JS.

React Native2 min read

Generating a signed release APK or AAB

Create a keystore, reference its credentials via gradle.properties (gitignored), wire a release signingConfig in build.gradle, then assembleRelease or bundleRelease.

React Native2 min read

Fabric UI update lifecycle vs old architecture

Render builds an immutable C++ shadow tree, commit diffs trees and runs Yoga layout, mount applies mutations to native views; JSI shares the tree, enabling synchronous and concurrent rendering unlike the…

React Native2 min read

TurboModule lazy loading vs eager startup

Legacy modules are instantiated eagerly at launch; TurboModules initialize only when JS first accesses them, so unused modules cost nothing at startup.

React Native2 min read

What JSI is and how it replaces the Bridge

JSI is a lightweight C++ layer letting JS hold references to native host objects and call them directly and synchronously, with no JSON serialization or async batched queue.

React Native2 min read

TurboModules and lazy loading benefits

TurboModules use JSI for direct, synchronous, type-safe calls and are loaded lazily on first use instead of all at startup, cutting init time.

React Native2 min read

Threading of native module methods

Methods run on a dedicated native module queue, not the UI thread; long blocking work stalls other module calls; offload to a background executor or override methodQueue, returning results via promise.