Skip to content

Instantly share code, notes, and snippets.

@sbycrosz
Created March 8, 2018 07:38
Show Gist options
  • Save sbycrosz/f1f7b8c29ed8dd2984acd0939e0e59bc to your computer and use it in GitHub Desktop.
Save sbycrosz/f1f7b8c29ed8dd2984acd0939e0e59bc to your computer and use it in GitHub Desktop.
SimpleReducer_CombinedAPI.js
// components/todos/index.js
import { connect } from 'react-redux';
import Todos from './Todos';
import { createLoadingSelector } from '../../redux/api/selectors';
// Show loading when any of GET_TODOS_REQUEST, GET_USER_REQUEST is active
const loadingSelector = createLoadingSelector(['GET_TODOS', 'GET_USER']);
const mapStateToProps = (state) => ({ isFetching: loadingSelector(state) });
export default connect(mapStateToProps)(Todos);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment