算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
react-component-patterns【设计与创意】Build modern React component architecture with composition patterns. Use when designing reusable React components, applying composition patterns, or structuring component hierarchies.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
children/named slot props for layout, Compound Components (e.g., <Select><Select.Option /></Select>) via Context for implicit shared state within one UI unit. Reach for Higher-Order Components or classic Render Props (render={(data) => ...}) only when composition can't express it (e.g. wrapping a third-party class component) — hooks cover most cross-cutting concerns HOCs used to.ref is a regular prop on function components — no forwardRef needed for new code. Use use(promise) / use(context) to read a promise or context conditionally in render instead of useContext + extra useEffect plumbing.useRef state) components. Favor controlled for form validation.<Cmp isVisible /> vs isVisible={true}.Cond ? <A/> : <B/>) over && for rendering consistency (prevents 0 rendering).function ThemedInput({ ref, ...props }: { ref?: React.Ref<HTMLInputElement> } & InputProps) {
return <input ref={ref} className={useTheme().input} {...props} />;
}
ref passed as a plain prop (no forwardRef) on components targeting React 19.ref as a normal prop instead.See references/patterns.md for Composition, Compound Components, and Render Props examples.