Skip to content
Dashboard

Introducing: React Best Practices

Copy link to headingThe core idea: ordering

Copy link to headingWhat else is inside?

async function handleRequest(userId: string, skipProcessing: boolean) {
const userData = await fetchUserData(userId)
if (skipProcessing) {
// Returns immediately but still waited for userData
return { skipped: true }
}
// Only this branch uses userData
return processUserData(userData)
}

async function handleRequest(
userId: string,
skipProcessing: boolean
) {
if (skipProcessing) {
return { skipped: true }
}
const userData = await fetchUserData(userId)
return processUserData(userData)
}

Copy link to headingHow these practices were collected

Copy link to headingUsing react-best-practices in your coding agent

npx skills add vercel-labs/agent-skills

Ready to deploy?