Home/Categories/Web 开发

Web 开发

Next.js、React、TypeScript、前端工程化

Collection

This collection features articles and community discussions in the Web 开发 space, focusing on real-world engineering scenarios, tool selection, practical paths, and risk boundaries.

The page is continuously updated and serves as a learning roadmap, technology selection reference, and technical review entry point.

@admin·16 min read·Web Development

Web Image Optimization: Formats, Responsive Images, and Lazy Loading

Images are often a page's largest resource, so optimizing them is key to LCP. This guide covers modern formats (WebP/AVIF vs. JPEG/PNG), responsive images (srcset/sizes), Next.js Image, lazy loading, placeholders, and dynamic CDN processing in a production-ready strategy.

#Next.js #React♥ 1640 comments
@admin·18 min read·Web Development

E2E Testing in Practice: Playwright

Unit tests validate individual units and integration tests validate combinations, but only E2E can answer whether users can actually use the product. This article covers Playwright's core capabilities, Page Objects, CI integration, and what E2E should and should not test.

#React #TypeScript♥ 1650 comments
@admin·16 min read·Web Development

React Portal: Modals, Tooltips, and Stacking Contexts

A modal rendered deep in a component tree can be clipped by parent z-index, overflow, or transform rules. Portal renders it in document.body to escape those constraints. Learn Portal fundamentals, a complete modal implementation, accessibility, and why Radix Dialog handles the hard parts.

#React #TypeScript♥ 1680 comments
@admin·21 min read·Web Development

TypeScript Generics and Utility Types: A Deep Dive

Generics are among TypeScript's most powerful and most overused features. This guide explains constraints, defaults, inference, built-in Utility Types, when generics help, and when they do not, with one principle throughout: types should help you, not trap you.

#Next.js #TypeScript♥ 1700 comments
@admin·18 min read·Web Development

Contract Testing: Consumer-Driven vs. Provider Verification

Microservice integration tests are expensive because every service must be started. Contract tests verify only that API agreements remain unchanged. This article explains Pact's consumer-driven flow: consumers define expectations and generate contracts, while providers verify them to reveal before merge whether a change breaks a frontend or downstream

#TypeScript #DevOps♥ 1720 comments
@admin·16 min read·Web Development

Web Font Optimization: Loading, Rendering, and CLS

Custom fonts improve design but can slow LCP and cause CLS when loaded poorly. This guide covers the full optimization path: font-display strategies (swap, fallback, and optional), preloading critical fonts, WOFF2 subsetting, FOUT vs. FOIT, variable fonts, fallback metrics, and a practical setup that looks good and stays fast.

#Next.js #React♥ 1740 comments
@admin·23 min read·Web Development

CSS Container Queries: True Component-Based Responsiveness

Media Queries respond to viewport width; Container Queries respond to the parent container's width, so a component adapts (different layouts in a narrow sidebar vs. a wide main area). This article covers the principles, the @container syntax, container-type settings, browser support, and how they reshape responsive design.

#React #TypeScript♥ 1750 comments
@admin·16 min read·Web Development

React Custom Hook Architecture: Extraction, Composition, and Testing

Hooks are more than useState/useEffect: custom Hooks are React's "unit of reuse." This article explains when to extract custom Hooks, how Hooks compose, dependency arrays and stale closures, testing with renderHook + act, and why not to over-abstract Hooks.

#React #TypeScript♥ 1770 comments