state.js 763 B

1234567891011121314151617181920212223242526272829303132333435
  1. /** @module matchList/state */
  2. /**
  3. * state.js
  4. *
  5. * Collection of everything which has to do with state changes.
  6. **/
  7. /** actionTypes define what actions are handeled by the reducer. */
  8. export const actions = {
  9. setState: matches => {
  10. return {
  11. type: 'SET_MATCHES',
  12. matches
  13. }
  14. }
  15. }
  16. console.log('State actions', actions)
  17. /** state definition */
  18. export const state = {
  19. allMatches: [],
  20. filteredMatches: [],
  21. filters: {}
  22. }
  23. console.log('State state', state)
  24. /** reducer is called by the redux dispatcher and handles all component actions */
  25. export function reducer (state = [], action) {
  26. let nextState = state
  27. return nextState
  28. }
  29. /** sagas are asynchronous workers (JS generators) to handle the state. */
  30. export function * saga () {}