Sawtaytoes
10/7/2018 - 3:00 AM

Simple loading state reducer

A simple generic reducer to say if you're in a loading state or not.

import { createReducer } from '@ghadyani-framework/redux-utils'

import {
  LOADED,
  LOADING,
} from './actions'

export const initialState = false

export const reducerActions = {
  [LOADED]: () => false,
  [LOADING]: () => true,
}

const isLoadingReducer = (
  createReducer(
    reducerActions,
    initialState,
  )
)

export default isLoadingReducer