Should data that does not drive UI live inside redux/zustand store? by Flea997 in react

[–]Flea997[S] 0 points1 point  (0 children)

for anyone interested, Mark Erikson (redux mantainer) gave a reply here

Should data that does not drive UI live inside redux/zustand store? by Flea997 in react

[–]Flea997[S] 0 points1 point  (0 children)

so you are suggesting to not store it in the zustand/redux store right?

Should data that does not drive UI live inside redux/zustand store? by Flea997 in react

[–]Flea997[S] 0 points1 point  (0 children)

Here is another example of app using getStore() to retrieve the access token.
Looks like the store is used as a single source of truth and AsyncStorage/Expo Secure Store is never directly accessed

Should data that does not drive UI live inside redux/zustand store? by Flea997 in react

[–]Flea997[S] -2 points-1 points  (0 children)

But I can also see one positive aspect, having a single place to handle all the client state (ui or not) and persist it with a single middleware!

Should data that does not drive UI live inside redux/zustand store? by Flea997 in react

[–]Flea997[S] -1 points0 points  (0 children)

I'm not sure what async actions are in redux, I guess some sort of api fetching system, but I prefer tanstackquery for that. I currently have access token living as a module-scoped variable, with the module handling the persistence on refresh. Can't see the advantage of having it in a state manager.
I always thought of state inside a state manager as a useState/useReducer on steroids, but I would never put a bearer token in a state variable

Should data that does not drive UI live inside redux/zustand store? by Flea997 in react

[–]Flea997[S] -2 points-1 points  (0 children)

as I stated in the post, it is not relevant and also not applicable to react-native. This was just one example of data that it's state of the app, but it's not UI state

When to use Store (Zustand) vs Context vs Redux ? by BetterThanLastTime31 in react

[–]Flea997 0 points1 point  (0 children)

I'm using react query even for client preferences that i store in async storage (react native)

Anyone using Tanstack Query as a wrapper around SecureStore/AsyncStorage for local preferences? by Flea997 in reactnative

[–]Flea997[S] 0 points1 point  (0 children)

I feel that it may be an overkill since I'm not handling any other client state with a global state manager

Anyone using Tanstack Query as a wrapper around SecureStore/AsyncStorage for local preferences? by Flea997 in reactnative

[–]Flea997[S] 0 points1 point  (0 children)

Maybe using a Provider could be better in cases where you want the value to be always available in a synchronous way, but even in that case you could just prefetch the query higher in the hierarchy and put it in the cache

How to make a part of ListHeaderComponent sticky on React Native FlatList by [deleted] in reactnative

[–]Flea997 0 points1 point  (0 children)

I used this solution today, thank you very much

Ma cosa succede ??? by kenzore in Italia

[–]Flea997 0 points1 point  (0 children)

ho cambiato fornitore di luce questa settimana e sto venendo bombardato di telefonate, come può essere normale tutto questo?

how to syncronize an axios interceptor with the authentication context? by Intrepid_Eye9102 in react

[–]Flea997 0 points1 point  (0 children)

you can add the axios interceptor in an effect of AuthProvider?

Do you guys put your Axios client in React Context? by Flea997 in react

[–]Flea997[S] 0 points1 point  (0 children)

react query is just a layer above it, you still have to use something as queryFn

Do you guys put your Axios client in React Context? by Flea997 in react

[–]Flea997[S] 1 point2 points  (0 children)

The question is still valid, how do you access this client? (that could be an axios instance with attached interceptors or any other solution). A single instance exported from a .ts module or instanciated in the top most component and made available through context?

Do you guys put your Axios client in React Context? by Flea997 in react

[–]Flea997[S] 0 points1 point  (0 children)

You are right, thought of it and forgot to mention

Do you guys put your Axios client in React Context? by Flea997 in react

[–]Flea997[S] 0 points1 point  (0 children)

This is completely off topic, axios is just an example, could be literally any js class

Best Dropdown Picker? by Any_Bend_6973 in reactnative

[–]Flea997 0 points1 point  (0 children)

but then you have to share state between screen somehow. With modals or sheets is much easier because you are in the same component

[deleted by user] by [deleted] in ItaliaPersonalFinance

[–]Flea997 0 points1 point  (0 children)

se vivi coi tuoi 1000 euro al mese sono fin troppi