I am trying to collect a data with API with axios. But let's say I want to use this data later on the code but whenever I get out of the async code the returned data's status becomes pending. How to return data and store it to use whenever I want in code?
Here is the code:
const fetchData = async () => {
const response = await axios.get("http://www.omdbapi.com/", {
params: {
apikey: "a7aeae67",
// s: `${searchBar.value}`
s: "vam"
}
})
}
console.log(fetchData())