0

I'm currently building up a mobile app using React-Native with React-Redux. Is there a way to access a Redux state (getState()) from within a function that's not in a component?

1 Answers1

0

Per the documentation, there are two ways you can use the AppState.

  1. Accessing AppState.currentState to get the current state (kept updated).
  2. Adding an event listener to the changes to AppState through AppState.addEventListener(type, handler).

If you need it once, use the first one. However, if you need to check for changes use the second.

Tukan
  • 2,253
  • 15
  • 17