Trying to display data from a json. When I run my functions on the console, it shows:
Promise {} and [[PromiseState]]: "fulfilled"
But not actually returning anything.
getJobs = async () => {
try{
response = await fetch("./data.json");
const data = await response.json();
return data;
} catch(error){
console.log('Error getting data', error)
}
}
renderJobs = async () => {
const jobs = await getJobs();
const view = `
<div class='card-company'>
${jobs.map(companyName => `
<p>${companyName.company}</p>
`).join('')}
</div>
`
return view
}
I have all the p tags I need inside the property [[PromiseResult]] but nothing displaying in the document.
I have not been able to find anything like this, also if there's anything to improve in this snippet, I appreciate the feedback.
Thank you.