[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/js/bp-core/js/block-assets/data/ -> reducers.js (source)

   1  /**
   2   * Internal dependencies
   3   */
   4  import { TYPES as types } from './action-types';
   5  
   6  /**
   7   * Default state.
   8   */
   9  const DEFAULT_STATE = {
  10      components: [],
  11  };
  12  
  13  /**
  14   * Reducer for the BuddyPress data store.
  15   *
  16   * @param   {Object}  state   The current state in the store.
  17   * @param   {Object}  action  Action object.
  18   *
  19   * @return  {Object}          New or existing state.
  20   */
  21  const reducer = ( state = DEFAULT_STATE, action ) => {
  22      switch ( action.type ) {
  23          case types.GET_ACTIVE_COMPONENTS:
  24              return {
  25                  ...state,
  26                  components: action.list,
  27              };
  28      }
  29  
  30      return state;
  31  };
  32  
  33  export default reducer;


Generated: Fri May 5 01:01:24 2023 Cross-referenced by PHPXref 0.7.1