Skip to content

Latest commit

 

History

History
18 lines (12 loc) · 681 Bytes

constants.md

File metadata and controls

18 lines (12 loc) · 681 Bytes

Constants are key-value maps of strings. It's important for defining action types. ModulaJS offers a helper function to create constants.

It's recommended to define action specific constants at top of a ModulaJS Model file.

import { createConstants } from 'modulajs';

// namespace, an object for constants like KeyMirror
export const ActionTypes = createConstants('MESSAGES', {
  CLEAR: null
});

// ActionTypes.CLEAR === 'MESSAGES_CLEAR'

Like KeyMirror, which creates an object with values equal to its key names, but with namespace.

Please refer to ModulaJS Constants API for more information.