议题与观点
通过 List 描述议题,通过 Comment 表达观点
Headless components
Intro:
- Brief definition of headless components...
What’s the difference with normal component?
- antd: composed with UI, logic, styles and everything
- headless: just pure logic
What are the bad parts:
- Complex architecture. need headless + UI library
- different mindset
What are the benefits:
- More reusable across applications
- Separate UI structure from style/theme
- Easier to implement design systems
- Promotes consistency and standardization
- Easier testing.(especially when UI changed)
Examples of popular headless UI libraries:
- @tanstack/table - headless UI table for React
- react-hook-form - headless form validation for React
Tutorial segment:
- Walk through building a simple table component with @tanstack/table
- Show setting props for columns, rows, styling etc.
- Style component based on props with CSS-in-JS
Tips for using headless components:
- How to customize styling
- Best practices for accessibility
- Pitfalls to avoid
Encourage Peoples to developer headless component first:
- Mindset: separate logic and UI
- Depends on how logic complex is - normal button are not.
- Careful on types
粗剪反馈
【TODO】
发布草稿
📕 Shownotes
大家好啊,本次更新带来了 Headless Component 的简要介绍,它的优势在于逻辑分离,更好地集成设计系统,易于测试;缺点则是会让架构复杂一层,以及完全不同的开发思维。
大家可以考虑在自己的业务中尝试这种新颖有趣的技术方案。但是也要注意业务场景。
有任何意见建议想法,都可以在评论区留言或者发邮件至 [email protected]
👨👨👦 主播
⏰ Timeline
00:18 Headless Component 是什么
01:27 优势: 逻辑重用,分离 UI,集成自定义设计系统,易于测试
05:30 弊端: 架构复杂,不同的开发思维
07:00 实例: TanStack table, react-hook-form
09:23 btw: 多数组件库不适应新的 React Server Component
10:38 大势所趋
11:20 但是取决于业务。to C 项目比较适合
🔗 相关链接
📚 扩展阅读
🤡 勘误
【TODO】
BGM by Otologic
后记
发布链接
【TODO】