Skip to content

Instantly share code, notes, and snippets.

@traverse
traverse / meta_pattern.md
Created May 7, 2018 06:58 — forked from minheq/meta_pattern.md
Using Meta Pattern to reduce redux boilerplate

Meta Pattern

When developing with Redux, often times we spend time on a lot of boilerplate code, and some common logic tend to become repeated. We can use Meta pattern to avoid code repetition while still taking advantage of Redux features. It is a simple concept and works like this:

In actions we define the actual type in meta property with name and type fields instead of type property. So a action looks like so:

{
  meta: {
    // Use logic/flow of this action
 type: STATIC_TYPE_NAME