Next.js Discord

Discord Forum

Next Image can't be used in a Shared Component Library?

Unanswered
Grass carp posted this in #help-forum
Open in Discord
Grass carpOP
- Next.js version: ^13.4.12
- TurboRepo.
- Shared UI library being used in Next.js App.

import Image from 'next/image';

Being used in shared component library:
Issue: Warning: React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.
<Image alt={imageAlt} src={imageSrc} fill className='rounded-xl' />


Being used in actual Next.js page.tsx
No issues
<Image alt='1' src='/dark-mode.webp' fill className='rounded-xl' />


The imageSrc is just a reference to an image in the Next.js app public directory.

Can Next.js <Image />, not be used in components?

0 Replies