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

208
Vistas
MateriaulUI Datagrid gives Invalid Hook Call

I have the simplest component ever. I imported DataGrid from MaterialUI, I made a variable for the columns and a variable for the rows, and I call the DataGrid in the render function of the function component. Now I receive a invalid hook call. I have seen this error on StackOverflow but there people used class components. I am using function components and there's nothing else inside the component. Yet I receive an error. How is this possible? What am I doing wrong?

import React from 'react'
import { DataGrid } from '@material-ui/data-grid'

const columns = [
    {field: 'something', headername: 'ID'},
    {field: 'title', headername: 'Title', width: 300},
    {field: 'body', headername: 'Body', width: 600}
]

const rows = [
    {id: 1, something: 'hello', title: 'title', body: 'body'}
]

function DataTable() {
    return (
        <div>
            <DataGrid rows={rows} columns={columns}/>
        </div>
    )
}

export default DataTable

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I was importing the wrong datagrid.

I changed the import statement to import { DataGrid } from '@mui/x-data-grid';

Additionally, I installed this package which seems to be essential for using materialUI. https://www.npmjs.com/package/@mui/material?activeTab=readme

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