MCPcopy Create free account
hub / github.com/bradtraversy/github-finder-app / githubReducer

Function githubReducer

src/context/github/GithubReducer.js:1–29  ·  view source on GitHub ↗
(state, action)

Source from the content-addressed store, hash-verified

1const githubReducer = (state, action) => {
2 switch (action.type) {
3 case 'GET_USERS':
4 return {
5 ...state,
6 users: action.payload,
7 loading: false,
8 }
9 case 'GET_USER_AND_REPOS':
10 return {
11 ...state,
12 user: action.payload.user,
13 repos: action.payload.repos,
14 loading: false,
15 }
16 case 'SET_LOADING':
17 return {
18 ...state,
19 loading: true,
20 }
21 case 'CLEAR_USERS':
22 return {
23 ...state,
24 users: [],
25 }
26 default:
27 return state
28 }
29}
30
31export default githubReducer

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected