This document focuses on React, but the same applies to Inferno and Preact
separating presentational and container components
, plus higher-order components
(HoCs).state
and its view
should be separated. In React, your state is typically passed into your view as props.withEffects
higher-order component.Counter
, we use withEffects
to create an enhanced version of the component:CounterWithEffects
component now includes the side-effect logic included in our handler
and aperture
, and renders the original Counter
presentational component unaltered. It can be used just like any other component: