Generating container components with connect utility in react redux app

Presentational component specifies look of the component where as Container component specifies how the behavior of it. I would recommend reading Presentation vs container components.

In well architected react-redux app, Container components have two major responsibilities:

  1. Re-render the presentational component when store updates
  2. Define the behavior of presentational components by passing the necessary data and dispatch callbacks to update the store

Generating containers component without connect from react-redux

Generating containers component with connect from react-redux

  • In this approach, the container components do not need to access the redux store via context. Hence, they do not need to specify the contextType explicitly.

You may also like...

Leave a Reply

Your email address will not be published.