skip to Main Content

How does NextJS execute the code inside these functions with and without async? – Javascript

Function with async: export async function getPostData(id) { const fullPath = path.join(postsDirectory, `${id}.md`); const fileContents = fs.readFileSync(fullPath, 'utf8'); const matterResult = matter(fileContents); return { id, ...matterResult.data, }; } Function without async: export function getPostData(id) { const fullPath = path.join(postsDirectory, `${id}.md`);…

VIEW QUESTION
Back To Top
Search