Usage docs Reference Examples

src/docs.js

  1. // This file is to enhance the documentation with typedefs + external links
  2.  
  3. /**
  4. * A redux thunk, dispatch this to run it. https://github.com/reduxjs/redux-thunk
  5. * @typedef {function(dispatch:*, getState:*) | function(dispatch:*)} ReduxThunk
  6. */
  7.  
  8. /**
  9. * A redux action type.
  10. * @typedef {string} ReduxActionType
  11. */
  12.  
  13. /**
  14. * A redux saga (a generator returned by a generator function). https://redux-saga.js.org/
  15. * @typedef {Generator<*>} ReduxSaga
  16. */
  17.  
  18. /**
  19. * A redux reducer.
  20. * @typedef {Reducer<any> | Reducer<any, AnyAction>} ReduxReducer
  21. */
  22.  
  23. /**
  24. * Redux state selector. Maps the whole state to just a specific part of the state.
  25. * This is used to structure and re-combine ReDApp modules however you like,
  26. * if you prefer something else than the default.
  27. *
  28. * @example
  29. * // get redapp root
  30. * getRootState: (state) => state.redapp
  31. *
  32. * // From redapp root state to tracking state.
  33. * getTrackingState: (state) => getRootState(state).tracking
  34. *
  35. * // From tracking state to transactions state.
  36. * getTransactionsState: (state) => getTrackingState(state).transactions
  37. *
  38. * @typedef {function(state:object):*} ReduxStateSelector
  39. */