Sorry new React guy here and cant for the life of me figure out this issue.
This is just the necessary code snippets of my app but Im just trying to get the contents of the clicked Datagrid row, pass to the Dialog form and then call my other component passing the row info. I get the row info no problem. It just never shows up in the props on the second component. I can pass anything else just fine to the other component (text, variable etc..) Just not the setsendRowInfo info. Any help would be apprectiated!
let [sendRowInfo, setsendRowInfo] = useState([]);
function DataTable(){
const handleOnCellClick = (params) => {
setOpen(true);
name = params.row;
setsendRowInfo = params.row;
};
}
return (
<div style={{ height: 700, width: "100%" }}>
<DataGrid
{...tableData}
slots={{
toolbar: CustomToolbar,
}}
rows={tableData}
columns={columns}
pageSize={10}
containerBackground="#fff"
checkboxSelection
disableRowSelectionOnClick
onRowClick={handleOnCellClick}
columnVisibilityModel={{
id: false,
}}
<Dialog open={open} onClose={handleClose}>
<Slide direction="down" in={open} mountOnEnter unmountOnExit>
<DialogTitle className="titleaddnew">
<img className="logo" src={Logo} alt="logo" />
<strong>Enter Application Info:</strong>
</DialogTitle>
</Slide>
<DialogContent>
<div>
<MyForm send = {{setsendRowInfo}} />
</div>
</DialogContent>
</Dialog>
;
</div>
);
}
export default DataTable;
function MyForm(props) {
let [rowResults, setrowResults] = useState();
setrowResults = props.send;
console.log(setrowResults );
Tried passing the state multiple different ways to no avail .
Jeff Miller is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.