uses useState to set the searchQuery state on button click and also uses the searchQuery to update the URL before calling the fetchData function with the URL.
The problem is that the searchQuery is not updated before the fetchData function call.
How can I delay the fetchData call until the setSearchQuery hook is updated?
With promise
I don't have any exps in React, but I thing Async/Await will handle it🤷♂️
useEffect?
Обсуждают сегодня