Related Articles

Back to Latest Articles

Simple React Patterns

This excellent post by Lucas Reis introduces various patterns for writing React components.

Tilo Mitra
Simple React Patterns

This excellent post by Lucas Reis introduces various patterns for writing React components.

I’ve been writing React applications for a few years now, and I’ve noticed that some patterns tend to repeat themselves. In this post, I’ll review these patterns which will summarize about 99% of the React code I write every day.

As someone who writes a lot of React code, this is a great summary of common patterns. React does not need to be complicated. Vanilla components and the Container/Component Pattern comprise of most of my React development.

Lucas also presents the concepts of Higher Order Components and Render Props effectively:

Regular React components work well most of the time, but it’s better to try separating logic from view. If you need to reuse logic for different view components, use HOCs or Render Props. If the logic involves expensive side effects that should only run once, use a provider.

If you want to learn more about Render Props, I recommend watching the article, “Never Write another HOC” by Michael Jackson, creator of React Router.

Show Comments (0)


Related Articles


Context API in React 16.3

The new Context API may replace Redux for a lot of apps out there. Definitely check it out if you are using React and Redux nowadays.

Posted on by Tilo Mitra
Vanilla Javascript

How do JavaScript Page Lifecycle Events work?

Let's talk about the different JavaScript events that fire when loading and unloading a page.

Posted on by Tilo Mitra


Get future articles sent directly to your inbox.

I only send emails when I write something new.