I am currently utilizing the Material-UI library in React to present a table on my webpage. My goal is to have a sticky header on the table without specifying a fixed height, allowing it to scroll along with the page. However, the code snippet provided does not achieve this functionality unless a height is set on the TableContainer element.
import React from "react";
import {
TableContainer,
Table,
TableHead,
TableRow,
TableCell
} from "@material-ui/core";
import "./styles.css";
export default function App() {
return (
<TableContainer>
<Table stickyHeader>
<TableHead>
<TableRow>
<TableCell>Value</TableCell>
</TableRow>
</TableHead>
{
Array(100).fill("Test").map((e) => <TableRow><TableCell>{e}</TableCell></TableRow>)
}
</Table>
</TableContainer>
);
}