createEntities API

All three entities (createActions, createReducers and createSelectors) function have pretty similar API – so, instead of writing about 5 six of code, we can just write 2. This is the whole idea of this function, and the following examples illustrates it:

import { createEntities } from 'redux-tiles';
import tiles from '../tiles';

// in case you use _only_ redux-tiles, feel free to keep it
// on the top level, and just omit second argument
const { actions, reducer, selectors } = createEntities(tiles, 'redux_tiles');

The second argument

The second argument (redux_tiles here) is optional, but necessary if you want to put your reducer under some namespace (so, integrate it with other reducers). In this case it will be performing all selectors under this namespace, and for correct work you have to combine this reducer under this key:

import { combineReducers } from 'redux';
import { reduxTileReducer } from '../entities';
import reducers from './reducers';

const reducer = combineReducers({
  redux_tiles: reduxTileReducer,

Tiles parameter

createActions takes a single parameter, tiles, and it can be an array or an object of tiles. The next structure is allowed:

const userTiles = [userLogin, userData, userPreferences];
const uiTiles = [notifications, popup];
const arrayTiles = [

const objectTiles = {

results matching ""

    No results matching ""