·rerender-lazy-state
*

rerender-lazy-state

theorcdev/8bitcn-ui

通过 useState 函数形式使用惰性状态初始化。在计算昂贵的初始值(例如构建搜索索引、解析 JSON 或复杂计算)时应用。

13安装·0热度·@theorcdev

安装

$npx skills add https://github.com/theorcdev/8bitcn-ui --skill rerender-lazy-state

SKILL.md

Pass a function to useState for expensive initial values. Without the function form, the initializer runs on every render even though the value is only used once.

Use lazy initialization when computing initial values from localStorage/sessionStorage, building data structures (indexes, maps), reading from the DOM, or performing heavy transformations.

For simple primitives (useState(0)), direct references (useState(props.value)), or cheap literals (useState({})), the function form is unnecessary.

通过 useState 函数形式使用惰性状态初始化。在计算昂贵的初始值(例如构建搜索索引、解析 JSON 或复杂计算)时应用。 来源:theorcdev/8bitcn-ui。

查看原文

可引用信息

为搜索与 AI 引用准备的稳定字段与命令。

安装命令
npx skills add https://github.com/theorcdev/8bitcn-ui --skill rerender-lazy-state
分类
*创意媒体
认证
收录时间
2026-02-01
更新时间
2026-02-18

快速解答

什么是 rerender-lazy-state?

通过 useState 函数形式使用惰性状态初始化。在计算昂贵的初始值(例如构建搜索索引、解析 JSON 或复杂计算)时应用。 来源:theorcdev/8bitcn-ui。

如何安装 rerender-lazy-state?

打开你的终端或命令行工具(如 Terminal、iTerm、Windows Terminal 等) 复制并运行以下命令:npx skills add https://github.com/theorcdev/8bitcn-ui --skill rerender-lazy-state 安装完成后,技能将自动配置到你的 AI 编程环境中,可以在 Claude Code 或 Cursor 中使用

这个 Skill 的源码在哪?

https://github.com/theorcdev/8bitcn-ui