APERVEIL / DOCS / REACT
Next.js — React
Use Aperveil shaders in Next.js: App and Pages Router, server rendering with no dynamic() or ssr: false, fallbacks, blocks and fonts.
05
Next.js and server rendering
The components are marked "use client". In the App Router, import one straight into a server component page or layout: no dynamic() and no ssr: false are needed. The page renders on the server and the shader starts in the browser, where WebGPU is. The Pages Router works the same way, from any page under pages/.
- Fallback. Anything can be the
fallback,next/imageincluded. It shows only in a browser without WebGPU, after the check, so the server's HTML and the browser's first render always match. - Blocks. In the App Router a block's stylesheet import works as it is; the Pages Router accepts global CSS in
pages/_app.tsxonly, so move it there (see Blocks). - Fonts. Load a block's typefaces with
next/fontor the Google Fonts link in its README.
Color Looks, browser support, performance and access are the same on every platform: see the overview.