Quick and dirty implementation of reselect
. This assumes you already have the requirements for Redux installed and in operation.
yarn install reselect
// Reducer file import { createSelector } from 'reselect'; /* Selectors */ const getElementsUi = (state) => state.sidebarReducer.elementsUi; export const getElementsUiState = createSelector( [getElementsUi], (elementsUi) => elementsUi ); // In file calling mapStateToProps const mapStateToProps = (state) => ({ elementsUi: reducers.getElementsUiState(state) }); // Basic mapping dispatch const mapDispatchToProps = (dispatch) => ({ dispatch: dispatch }); // Basic wiring of program export default connect( mapStateToProps, mapDispatchToProps )(Component);