Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

160
Vistas
Image is missing required "src" property when valid src is provided as a prop

I'm having problems in Next.JS with getting a component to accept an image source through a prop. I'm passing the path of an image named "logo.jpg" located in the project's public folder. When passed as a prop for another component, it accepts the image and uses it correctly. When used as a prop for the problem component, it doesn't recognise that the path is even being read.

How can I resolve this problem, so that Next.JS will recognise and use the path of an image fed as a prop?

Error produced by console

Image is missing required "src" property: 
<img alt="" src="data:image/gif;base64,R0…AAAALAAAAAABAAEAAAIBRAA7" decoding="async" data-nimg="intrinsic" style="position:absolute;top:0;…ht:100%;max-height:100%">

(Relevant) File Structure

card-page
├───components
│       card.js
│       cardlink.js
├───pages
│       _app.js
│       index.js
└───public
        logo.jpg

Working Component (card.js)

import React from 'react'
import Image from 'next/image'
import styles from '../styles/card.module.css'

export default function Card( {title, image, alt, description} ) {
    console.log(image)
    return(
        <div className={styles.container}>
            <Image
            src={image}
            width="200"
            height="200"
            alt={alt} />
            <h1>{title}</h1>
            <p>{description}</p>
        </div>
    )
}

Broken Component (cardlink.js)

import Image from 'next/image'
import Link from 'next/link'
import styles from '../styles/cardlink.module.css'

export default function CardLink( text, image, href ) {
    console.log(image)
    return(
        <div className={styles.container}>
            <Image
            src={image}
            width={64}
            height={64}
            alt="" />
        </div>
    )
}

index.js

import Head from 'next/head'
import Image from 'next/image'
import styles from '../styles/home.module.css'

import CardLink from '../components/cardlink'
import Card from '../components/card'

export default function Home() {
    return (
        <div className={styles.container}>
            <Card
            image="/logo.jpg" />
            <CardLink
            image="/logo.jpg"
            text="Link 1"
            href=""
            alt="what"
            />
        </div>
    )
}
about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You have a typo here

Before:

export default function CardLink( text, image, href ) {

After:

export default function CardLink({ text, image, href }) {
about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda