Answer the question
In order to leave comments, you need to log in
How to fix the simultaneous call of 2 or more identical functions?
Hello, I have an application that has 2 components that can be shown simultaneously on the page together or separately. In the second case, everything is OK, but in the first case, there is a problem of double calling the data request function in the API.
Here is an example of the implementation of two identical requests: https://codesandbox.io/s/14q587x107
Question: how to get rid of this?
Answer the question
In order to leave comments, you need to log in
Why are you writing the same code twice?
fetch("https://jsonplaceholder.typicode.com/users")
.then(response => response.json())
.then(json => console.log(json));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question