Integration

Client-only module marker

This marker helps detect accidental server imports of browser-specific modules. It is not a replacement for the use client boundary, nor does it mean browser APIs are safe at module initialization during prerender. Example context: isolated Next.js 16.x candidate; snippet is partial unless it defines a complete convention file. Lifecycle: documented. Expected behavior / verification: Call only from an appropriate browser event or effect. Verify an accidental server import produces a build diagnostic and that initial rendering does not access window. Source: https://nextjs.org/docs/app/getting-started/server-and-client-components Exact installed signature, typecheck and framework execution not run.

Formal Syntax & Structure

nextjs syntaxnextjs
import 'client-only'

Working Example

Example Snippetnextjs
import 'client-only'; export function readViewport(){return window.innerWidth}
Next.js Reference