import React from "react"; import { List, useRecordContext, Datagrid, TextField, EditButton, BooleanField } from 'react-admin'; import { TableHead, TableRow, TableCell } from '@mui/material'; const DatagridHeader = ({ children }) => { console.log(children,"children is") return ( <TableHead> <TableRow> <TableCell>id</TableCell> {/* empty cell to account for the select row checkbox in the body */} {/* {Children.map(children, child => ( */} <TableCell> name </TableCell> {/* ))} */} </TableRow> </TableHead> ) } const DatagridHeaderList = () => ( <List resource="t_geyao_person"> <Datagrid header={<DatagridHeader> </DatagridHeader>}> </Datagrid> </List> ) export default DatagridHeaderList
运行结果