So here is my problem. Using async functions my response throws undefined but when i submit the second time throws the right response. here is my function:
let showcode = async (data) => {
try {
setLoading(true);
const url = `https://fortnite-api.com/v2/creatorcode?name=${data.code}`;
let res = await axios.get(url);
setInfo(res);
console.log(info);
setLoading(false);
} catch (err) {
setLoading(false);
console("error aca "+ err);
}
};