My react applications cache nothing and don’t use global state except to put the user Id in localstorage. No redux, no context, no network cache, no nothing. Minimal props. I just use custom events to tell the rest of the application what to. And use fetch to get stuff. Does away with all the complexity of state management or prop drilling.
This is insane when react query is available and so easy to use.
TanStack Query(a.k.a. React Query) v5 announced
61–64 of 64 posts
Re: TanStack Query(a.k.a. React Query) v5 announced
#62My react applications cache nothing and don’t use global state except to put the user Id in localstorage. No redux, no context, no network cache, no nothing. Minimal props. I just use custom events to tell the rest of the application what to. And use fetch to get stuff. Does away with all the complexity of state management or prop drilling.
If you have multiple components that require access to the same data do you fetch the same data multiple times?
Or I ask multiple times.
Asking multiple times is a tradeoff - if you are really needing to economise on back end server load then maybe front end caching matters more. But if your back end isn't going to mind, then ask again.
Re: TanStack Query(a.k.a. React Query) v5 announced
#63is there a non react equivalent? I wanna vomit every time I see the word "hook" these days.
The underlying TanStack Query library is UI-agnostic, and has adapters for React and other frameworks. (There's also our RTK Query API that's part of Redux Toolkit, which is UI-agnostic but also has a React adapter.)