Skip to content

Tag: javascript

Use Axios .then() with for loop index variable

I want to iterate some page URLs, stored in an array, and retrieve them to do an operation over their html file. Since I need to store a result from said operation for each page to use them the next time I call the function, I want to pass the index (i) in the onResponse call so that it can

Toggle Class With Font Awesome Not Working

I have multiple buttons, when a like button is clicked I would like the font awesome icon to switch as well, however, the way I have it set up the font awesome icon just disappears, but I can see the class change. Not sure where to go from here. Answer If you want to change icon/style just add other class

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.

How to create a nested list by sending data from a function

I have the next code: I get in console the next: And my expected output in console would be: But I don´t get that in console, as you can see I was trying to get that data in my filli function, sending an index, name, and words but it doesn’t work. I hope you can help me, thank you. Answer