-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathselectors.js
More file actions
28 lines (20 loc) · 873 Bytes
/
selectors.js
File metadata and controls
28 lines (20 loc) · 873 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { createSelector } from 'reselect';
import get from 'lodash/get';
import { initialState } from './reducer';
/**
* Direct selector to the homeContainer state domain
*/
export const selectHomeContainerDomain = (state) => state.homeContainer || initialState;
/**
* Other specific selectors
*/
/**
* Default selector used by HomeContainer
*/
export const selectHomeContainer = () => createSelector(selectHomeContainerDomain, (substate) => substate);
export const selectReposData = () =>
createSelector(selectHomeContainerDomain, (substate) => get(substate, 'reposData'));
export const selectReposError = () =>
createSelector(selectHomeContainerDomain, (substate) => get(substate, 'reposError'));
export const selectRepoName = () => createSelector(selectHomeContainerDomain, (substate) => get(substate, 'repoName'));
export default selectHomeContainer;