We have hooks, then still do we use Container components and Presentational components?
還沒有人認領這個 Issue。
- 主要語言
- JavaScript
- 星號
- 11.8k
- 分支
- 7.9k
- 平均合併
- 1 天 11 小時
- 30 天內合併 PR
- 11
描述
I think it is a bit confusing and maybe a doc or writing can explain the situation.
After we have hooks, do we still design our app into Container components and Presentational components? (Does it mean we should not divide up our app design into containers and presentational components?)
Or does it simply mean: in the past we use class components as containers with states, and function components as presentation components, and now we can use function components as both containers and presentational components, and the recommendation is still to divide our app design into containers and presentational component?
In the past, we can simply use class components ONLY and we could still divide our app design into containers and presentational components. So function component having state doesn't change that situation... the question is more like should we now still divide our app design into containers and presentational component? So nowadays we could still make container components using function components, and then, make presentational components and use function components to do that, and strictly do not use any hooks in them, because then they become stateful and therefore not just "presentational".
I think the short version of the question is: even with function components able to use states, should we still divide up our app into components that have states, and components that strictly do not have states and like "pure function" to present data?
@gaearon
In the past, in ReactJS, one way was to divide our components into Container components and Presentational components, and even Dan Abramov wrote a note about it not any more the case if we can use Hooks now.
How should it be done now — how does Hooks solve the problem?
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
閱讀 issue 內容,以及連結的 Stack Overflow 問題和 Dan Abramov 的說明。完成的標準是為 React 文件撰寫一份聚焦的說明,回答 Hooks 是否會改變關於 container/presentational 元件的指引。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- javascript, react
- 領域
- documentation, frontend
- Issue 類型
- 文件
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 35/100