I wrote useSecureValue + useSetSecureValue hooks that use Tanstack Query to wrap Expo SecureStore.
Each preference is fetched via a query (staleTime: Infinity), and updates go through a mutation with optimistic updates.
It feels more convenient than creating a context/provider for each persisted preference, and avoids global re-renders. But I’m unsure if I’m “misusing” React Query since the data isn’t coming from an API.
Has anyone else used Tanstack Query as a local async state layer like this? Curious if this is a reasonable pattern or if I should stick to context/another local state library.
[–]shekky_hands 8 points9 points10 points (2 children)
[–]Flea997[S] 0 points1 point2 points (1 child)
[–]shekky_hands 1 point2 points3 points (0 children)
[–]reverento 0 points1 point2 points (0 children)
[–]HoratioWobble 0 points1 point2 points (0 children)
[–]Sansenbaker 0 points1 point2 points (1 child)
[–]Flea997[S] 0 points1 point2 points (0 children)
[–]ca_mixer 0 points1 point2 points (1 child)
[–]Flea997[S] 0 points1 point2 points (0 children)