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

378
Vistas
React - The `component` prop provided to ButtonBase is invalid. Please make sure the children prop is rendered in this custom component

I am trying to use custom SVG icons to replace the base icons from Pagination component of Material UI (V4), and I keep getting this error in the console:

Material-UI: The component prop provided to ButtonBase is invalid. Please make sure the children prop is rendered in this custom component.

Now the code I'm using in that scenario is the following (relevant pieces):

import React from 'react';
import { Pagination, PaginationItem, PaginationRenderItemParams } from '@material-ui/lab';
import { ReactComponent as ChevronLeft } from 'assets/ChevronLeft.svg';
import { ReactComponent as ChevronsLeft } from 'assets/ChevronsLeft.svg';
import { ReactComponent as ChevronRight } from 'assets/ChevronRight.svg';
import { ReactComponent as ChevronsRight } from 'assets/ChevronsRight.svg';
import { ReactComponent as ChevronDown } from 'assets/ChevronDown.svg';

const ResourceTable = (props: TableProps): JSX.Element => {

  const showPaginationItem = (item: PaginationRenderItemParams) => {
    if (item.type === 'first') {
      return (
        <PaginationItem
          {...item}
          component={React.forwardRef<SVGSVGElement>(function Link(props, _) {
            return <ChevronsLeft {...props} />;
          })}
          shape="rounded"
        />
      );
    } else if (item.type === 'previous') {
      return (
        <PaginationItem
          {...item}
          component={React.forwardRef<SVGSVGElement>(function Link(props, _) {
            return <ChevronLeft {...props} />;
          })}
          shape="rounded"
        />
      );
    } else if (item.type === 'next') {
      return (
        <PaginationItem
          {...item}
          component={React.forwardRef<SVGSVGElement>(function Link(props, _) {
            return <ChevronRight {...props} />;
          })}
          shape="rounded"
        />
      );
    } else if (item.type === 'last') {
      return (
        <PaginationItem
          {...item}
          component={React.forwardRef<SVGSVGElement>(function Link(props, _) {
            return <ChevronsRight {...props} />;
          })}
          shape="rounded"
        />
      );
    } else return <PaginationItem {...item} shape="rounded" />;
  };

  return (
    <Pagination
            count={totalPages}
            onChange={handleChangePage}
            page={page}
            renderItem={showPaginationItem}
            showFirstButton
            showLastButton
        />
  );
};

The Material UI docs suggest that I should "avoid inline functions and pass a static component to the component prop instead. I tried that as well, and the error is still there. Is there something I am missing, that would allow me to get rid of the error?

Thank you very much for your help;

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