React: Container vs Presentational Components

I’ve been relearning React and, starting from the basics, I learned a fun(damental) React fact: there¬†are two core types of React components.

Container vs Presentational Components

Container Components

  • Manage behavior, marshalling data,¬† and actions
  • Are “smart”
  • Have little to no markup
  • Don’t emit DOM
  • Pass data and actions down to children
  • Are stateful
  • Are created using Redux’s `connect` function at the bottom of file
  • Know about Redux

Presentational

  • Nearly all markup
  • Are ‘dumb”
  • Have no logic
  • Receive data/actions via props
  • Don’t know about Redux

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.