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

333
Vistas
How to spread maxWidth property as max-width on a React component? If I pass it down as maxWidth property I get an error

I am getting the following error because I'm probably not spreading the maxWidth property correctly:

Warning: React does not recognize the maxWidth prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase maxwidth instead. If you accidentally passed it from a parent component, remove it from the DOM element.

I believe the error stems from the way I'm spreading the properties to the component:

export const Card = forwardRef<HTMLDivElement, CardProps>(
  ({ outline, elevation, width = 'inherit', maxWidth='650px', isModal, ...props }, ref) => {
    const CardWrapper = isModal ? DialogWrapper : Wrapper 
    return (
      <CardWrapper
        ref={ref}
        {...{ outline, elevation, width, maxWidth, ...props }}
      >
        <CardContent {...{ elevation, isModal, ...props }} />
      </CardWrapper>
    )
  }
)

As you can see I'm spreading maxWidth='650px' when it should be max-width='650'. The problem is that I'm not sure how to spread it using an alias or something

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

maxWidth is actually not a prop on a DOM element. maxWidth is a style and should be used like this <div style={{maxWidth:'650px'}}> or else your CardWrapper accepts maxWidth as prop

about 4 years ago · Juan Pablo Isaza 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