·hydration-safe-inputs
</>

hydration-safe-inputs

ethanniser/hydration-test

修復 React 水合問題,即當 React 接管時,用戶在水合之前鍵入的輸入會被擦除/清除。在以下情況下使用:(1) 用戶報告頁面加載時輸入字段被清除,(2) 使用已控制輸入的 SSR/SSG React 應用程序(Next.js、Remix、Astro),(3) 審核表單的水合安全性,或 (4) 在靜態渲染的 React 應用程序中構建新表單。

9安裝·0熱度·@ethanniser

安裝

$npx skills add https://github.com/ethanniser/hydration-test --skill hydration-safe-inputs

SKILL.md

In SSR/SSG React apps, there's a window between when HTML renders and when React hydrates. If a user types into an input during this window, React's hydration will wipe their input because React initializes state to the default value (usually empty string).

Initialize state by reading the DOM element's current value instead of a hardcoded default:

Search for these patterns that indicate potential hydration wipe issues:

修復 React 水合問題,即當 React 接管時,用戶在水合之前鍵入的輸入會被擦除/清除。在以下情況下使用:(1) 用戶報告頁面加載時輸入字段被清除,(2) 使用已控制輸入的 SSR/SSG React 應用程序(Next.js、Remix、Astro),(3) 審核表單的水合安全性,或 (4) 在靜態渲染的 React 應用程序中構建新表單。 來源:ethanniser/hydration-test。

查看原文

可引用資訊

為搜尋與 AI 引用準備的穩定欄位與指令。

安裝指令
npx skills add https://github.com/ethanniser/hydration-test --skill hydration-safe-inputs
分類
</>開發工具
認證
收錄時間
2026-02-04
更新時間
2026-02-18

快速解答

什麼是 hydration-safe-inputs?

修復 React 水合問題,即當 React 接管時,用戶在水合之前鍵入的輸入會被擦除/清除。在以下情況下使用:(1) 用戶報告頁面加載時輸入字段被清除,(2) 使用已控制輸入的 SSR/SSG React 應用程序(Next.js、Remix、Astro),(3) 審核表單的水合安全性,或 (4) 在靜態渲染的 React 應用程序中構建新表單。 來源:ethanniser/hydration-test。

如何安裝 hydration-safe-inputs?

開啟你的終端機或命令列工具(如 Terminal、iTerm、Windows Terminal 等) 複製並執行以下指令:npx skills add https://github.com/ethanniser/hydration-test --skill hydration-safe-inputs 安裝完成後,技能將自動設定到你的 AI 程式設計環境中,可以在 Claude Code 或 Cursor 中使用

這個 Skill 的原始碼在哪?

https://github.com/ethanniser/hydration-test

詳情

分類
</>開發工具
來源
skills.sh
收錄時間
2026-02-04

相關 Skills

暫無