React 笔记—核心概念
本文基于官方 v18.1.0 文档。
Introducing JSX
React embraces the fact that rendering logic is inherently coupled with other UI logic:
how events are handled, how the state changes over time, and how the data is prepared for display.
Instead of artificially separating technologies by putting markup and logic in separate files,
React separates concerns with loosely coupled units called “components” that contain both.
这是当初 React 最吸引我的地方,不执著于将 UI 和逻辑分开。MVC 大行其道几十年后,Android 跟 iOS 也都在尝试返濮了。
在我实际工作经验中,进行视图子类化定制的出发点往往就是为了将 UI 和其逻辑写在一起。这个需求越靠近业务层就越强烈。