The new Hooks API solves a lot of problems. But it does not solve the problem why we need Redux and Higher Order Components. This article explains why.

How to use the useReducer function

Consider a React app with independent container components: ‘Module A’, ‘Module B’, ‘Module C’ and so on. When I say independent, what I mean is Module A does not share state with Module B or Module C.…

Read More

What is a HOC?

Higher Order Component (HOC) is a function which accepts a base component and returns a decorated component.

const hoc = BaseComponent => props => (
  <BaseComponent {...props} />
)

The component that the HOC returns is a stateless functional component. At its most basic form, the base component is rendered with all the supplied props. The props can be overridden by a variation of HOC which accepts an option or configuration.…

Read More