How to use the redux.compose function in redux

To help you get started, we’ve selected a few redux examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github adamterlson / backbone-redux-store / sample / src / configureStore.js View on Github external
const makeShit = (bb) => {
    const reducer = bbReducerShim(bb);
    const enhancer = bbStoreEnhancer(bb);

    const store = createStore(
        reducer,
        {},
        compose(
            applyMiddleware(createLogger()),
            enhancer
        )
    );

    bb.on('__HELLO_ENHANCER__', (action) => store.dispatch(action, { silent: true }));

    return store;
};
github opennode / waldur-homeport / src / marketplace / category / filters / FilterBarContainer.tsx View on Github external
import { withTranslation } from '@waldur/i18n';

import { setFilterQuery } from '../store/actions';
import { getFilterName } from '../store/selectors';
import { FilterBar } from './FilterBar';

const mapStateToProps = state => ({
  filterQuery: getFilterName(state),
});

const mapDispatchToProps = dispatch => ({
  setFilterQuery: query => dispatch(setFilterQuery(query)),
});

const enhance = compose(
  connect(mapStateToProps, mapDispatchToProps),
  withTranslation,
);

export const FilterBarContainer = enhance(FilterBar);
github qhacks / qhacks-dashboard / packages / client / ClientStore.js View on Github external
function getStore(opt) {
  const store = createStore(
    combineReducers({
      [FORM_MOUNT]: formReducer
    }),
    compose(
      !IS_PROD && window.__REDUX_DEVTOOLS_EXTENSION__
        ? window.__REDUX_DEVTOOLS_EXTENSION__()
        : (f) => f
    )
  );

  return store;
}
github LiskHQ / lisk-desktop / src / components / shared / analyticsDialog / index.js View on Github external
import { connect } from 'react-redux';
import { withTranslation } from 'react-i18next';
import { settingsUpdated } from '../../../actions/settings';
import { toastDisplayed } from '../../../actions/toaster';
import AnalyticsDialog from './analyticsDialog';

const mapStateToProps = state => ({
  settings: state.settings,
});

const mapDispatchToProps = {
  settingsUpdated,
  toastDisplayed,
};

export default compose(
  connect(mapStateToProps, mapDispatchToProps),
  withTranslation(),
)(AnalyticsDialog);
github ryanatkn / ear-sharpener / src / main / createReduxStore / index.ts View on Github external
export default function createReduxStore(): Store {
  const reducer = combineReducers(assign({}, reducers, {
    routing: routerReducer,
  }));
  return createStore(
    reducer,
    getInitialState(),
    compose(...getStoreEnhancers())
  );
}
github opennode / waldur-homeport / app / scripts / components / user / support / UserDetailsView.tsx View on Github external
{props.userManageIsVisible && (
      
        <div>
          
        </div>
      
    )}
  
);

const mapStateToProps = state =&gt; ({
  userManageIsVisible: userManageIsVisible(state),
  isVisibleForSupportOrStaff: isVisibleForSupportOrStaff(state),
});

const enhance = compose(withTranslation, connect(mapStateToProps));

export const UserDetailsView = enhance(PureUserDetailsView);
github React-Proto / react-proto / src / store.js View on Github external
import logger from 'redux-logger';
import throttle from 'lodash.throttle';
import { composeWithDevTools } from 'redux-devtools-extension/developmentOnly';
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import reducers from './reducers';
import { saveState } from './localStorage';

let composer;

if (process.env.NODE_ENV === 'development') {
  composer = compose(
    applyMiddleware(logger, thunk),
    composeWithDevTools(),
  );
} else {
  composer = compose(applyMiddleware(thunk));
}

const store = createStore(
  reducers,
  composer,
);

store.subscribe(throttle(() => saveState(store.getState()), 1000));

export default store;
github AOSSIE-Org / CarbonFootprint-Mobile / app / config / store.js View on Github external
import { createStore, compose, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import logger from 'redux-logger';
import rootReducer from '../reducers/rootReducer';

/**
 * creating store for application
 */
const store = compose(applyMiddleware(thunk, logger))(createStore)(rootReducer);

export default store;