Redux Presentational Components Vs Container Component

前端 未结 3 1254
不思量自难忘°
不思量自难忘° 2020-12-01 20:10

I\'m beginner of react development with redux. I\'m wondering what are the Presentational Components and Container Components.

  • How to categorized components a
3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-01 20:31

    You’ll find your components much easier to reuse and reason about if you divide them into two categories. I call them Container and Presentational components.

    I assume you have knowledge about redux architecture

    Container Components

    • Aware of redux
    • Subscribe redux state
    • Dispatch to redux actions
    • Generated by react-redux
    • Focus on how things work

    Presentational Componets

    • Unaware of redux
    • Read data from props
    • Invoke callbacks on props
    • Written by developer
    • Focus on how thing look

    Benefits of categorizing components

    • Reusability
    • Separation of concerns

    For more details read this article

提交回复
热议问题