lazy component is not working because TypeError: Cannot convert object to primitive value #4343
-
detailI tried using lazy components using
And, editor displays this
Is not reproductionhttps://github.com/mecaota/bugged-preact/tree/issue/lazy-component-is-not-work In this repository, I wish show "This is lazy Component", but not.
install packages versionspaste from package.json dependencies
devDependencies
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
This is not a bug in Preact, what you are doing is One caveat in Preact is that |
Beta Was this translation helpful? Give feedback.
This is not a bug in Preact, what you are doing is
const Empty = lazy(() => import('@components/empty'));
but@components/empty
has no default export so what you should do isconst Empty = lazy(() => import('@components/empty').then(x => x.Empty);
One caveat in Preact is that
Suspense
needs a parent node, so wrapping it with a<div
helps 😅 we should fix that though