Created
March 8, 2018 07:38
-
-
Save sbycrosz/f1f7b8c29ed8dd2984acd0939e0e59bc to your computer and use it in GitHub Desktop.
SimpleReducer_CombinedAPI.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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