generated from wednesday-solutions/react-template
-
Notifications
You must be signed in to change notification settings - Fork 4
/
selectors.js
42 lines (34 loc) · 926 Bytes
/
selectors.js
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { createSelector } from 'reselect';
import get from 'lodash/get';
import { initialState } from './reducer';
/**
* Direct selector to the homeContainer state domain
*/
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', null)
);
export const selectReposError = () =>
createSelector(
selectHomeContainerDomain,
substate => get(substate, 'reposError', null)
);
export const selectRepoName = () =>
createSelector(
selectHomeContainerDomain,
substate => get(substate, 'repoName', null)
);
export default selectHomeContainer;