I am doing a react native application that on certain action of the user will start tracking gps position, and on other stop.
But i am hitting some road block not finding the correct way of doing this time based position tracker as it does not seem natural for the pattern. Here are the ideas I had:
- Treat it as async using
redux-thunk. - Use
redux-observabletimed event. - Use
sagas. - Use
SetTimeoutin mycomponent(is the simplest solution but I don't want to stop my users from navigating around, and i dont thing this is a UI responsability)
So I am going to leave this as reference for the future, with the simple solution i got finally working while i was working on writing this question.
So i understand that this might not be scalable and you might need to use
epicsunderredux-observableorsagas. The difficulty that I faced in this 2 where:redux-observableclear the recurring event was not clear (or looked like a workaround to kind of pause it).sagasdont seem simple to scale or agregate.With
redux-observableshere is the code i kind of got to, if anyone has a good idea for this kind of case i will like to hear about it :) :special thanks Jay Phelps in the question I made in the repo https://github.com/redux-observable/redux-observable/issues/168