A function that takes in a function as an argument, returns a function, or both.
f(g(x)) = g(x) => g'(x)
f(g(x)) = g(x) => g'(x)
g'(x) = g(h(x))
g'(x) = h(g(x))
React.createClass
Extending React.Component
Stateless Functional Component
React components typically contain a mix of
logic and presentation.
| Container | Presentational |
|---|---|
| 关心逻辑 | 关心视觉表现 |
| Render presentational components | Render the HTML markup (or other components) |
| Make API calls and manipulate data | Receive data from props |
| Define event handlers | Use event handlers from props |
| Written as classes | Often written as stateless functional components |
A component is a map from model to view.
Component = model => view
props + context
rendered component tree
f(g(x)) = g(x) => g'(x)
g'(x) = g(h(x)) : props proxy
g'(x) = h(g(x)) : render highjacking
component = model => view
g : component
x : model
g(x) : view
f : high oder component