0

I'm currently building a React Native application and wondering if storing device information such:

  • if my app has granted location permission
  • location service is turned on
  • last known user location

in the Redux store can be a good idea.
I have different components that needs to know this informations and storing in Redux can grant me a predictable state. In the case, maybe I can store them like this:

{
  user: {
    id: '123'
    name: 'Markus'
    ...
  },
  device: {
    locationPermission: 'denied'
    locationActive: false
    lastKnownLocation: {
      lat: 44.123,
      lng: 32.123
    }
  },
  ...
}

Are there any cons about this approach?

0

Yes off course if you are sharing device info between different screens and component, then storing in store is a good option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.