UNPKG

@mui/x-data-grid

Version:

The Community plan edition of the MUI X Data Grid components.

31 lines (30 loc) 931 B
'use client'; import _extends from "@babel/runtime/helpers/esm/extends"; import * as React from 'react'; export const propsStateInitializer = (state, props) => { return _extends({}, state, { props: { listView: props.listView, getRowId: props.getRowId, isCellEditable: props.isCellEditable, isRowSelectable: props.isRowSelectable } }); }; export const useGridProps = (apiRef, props) => { const isFirstRender = React.useRef(true); React.useEffect(() => { if (isFirstRender.current) { isFirstRender.current = false; return; } apiRef.current.setState(state => _extends({}, state, { props: { listView: props.listView, getRowId: props.getRowId, isCellEditable: props.isCellEditable, isRowSelectable: props.isRowSelectable } })); }, [apiRef, props.listView, props.getRowId, props.isCellEditable, props.isRowSelectable]); };