Skip to content

Tag: reactjs

What are staleTime and cacheTime in React-Query?

I have read React Query docs. Still, I do not understand how to use staleTime & cacheTime for data caching. I want to store data for 2 mins in the cache after first-time API call. No matter if the component mounts or unmounts, I don’t want an API call for 2 mins after the first time I got the data.

Lodash to check object property on array elements

I want to use lodash to find a property of an object at a specific array element. Lets say I am hitting an api and getting response which sets it to the react state “personsDetails” (whose initial value was null), so now it becomes now when i want to access “name” property of 2nd objec…