Switch to react-query for API interactions #791
gmaclennan
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently we use React Context for storing observation and preset state, and use custom hooks to keep that data in sync with Mapeo Core. Using context is necessary on Mobile because with
react-navigation
each screen is rendered as a separate tree and observation state needs to be in sync across several screens. Passing observations and presets as props to the whole app would have a performance costs.react-query
treats data from an async API as cached data, e.g. rather than loading observations into a local app state in context and trying to keep that in sync, it treats it as cached data. This should simplify the code (a lot of the logic we need is in React Query) and enable us to use the same code between mobile and desktop.Beta Was this translation helpful? Give feedback.
All reactions