Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

209
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!