React · Junior · Question 37 of 75
Why does lazy(() => import('./Chart')) fail if Chart.tsx has only export function Chart?
- ✓Correct answer:
lazyexpects a module with adefaultexport - 2
lazydoesn't support TypeScript.tsxfiles - 3A component for
lazymust be a class component
Explanation
The promise from import() must resolve to an object with a default field. For a named export, map it: lazy(() => import('./Chart').then(m => ({ default: m.Chart }))). TypeScript and function components are fully supported.