Styles and Standards


We stick to the Flux Standard Action spec. This states that an action must take the following shape:

    type: 'CONST',
    meta: {
        // Everything in 'meta' will *only* handled by middleware
    payload: {
        // Payload contains all data for use within a reducer
    error: '' // An optional error parameter

By sticking to this format we separate middleware logic from reducer payloads.


Name selectors with a get prefix. For example, if your selector gets an array of blog post titles, it might be named getPostTitles.

Why? If we name it postTitles we'll have an import like import { postTitles } from './selectors'; at the top of our code, and nothing else will be able to be called postTitles within that entire file. Essentially we'll have to rename our props from postTitles to something else.

Giving a prefix to all selectors means:

  1. We don't pollute component namespaces with the above issue
  2. It's easy to tell when something's a selector via the get prefix
  3. It's easy to search and replace these names within your project