AG-2653 Put React Hook example together, update docs

This commit is contained in:
Sean Landsman
2019-02-12 14:45:24 +00:00
parent e07c66c95d
commit 74ccfa6b26
6 changed files with 155 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
import React, { useContext } from "react";
import {Context} from "./store";
import {AgGridReact} from "ag-grid-react";
/*
* This component serves to display the row data (provided by redux)
*/
export default function GridComponent() {
const {store, dispatch} = useContext(Context);
const {columnDefs, rowData} = store;
const onGridReady = (params) => {
params.api.sizeColumnsToFit();
};
// row data will be provided via redux on this.props.rowData
return (
<div style={{height: 400, width: 900, marginTop: 15}}
className="ag-theme-balham">
<AgGridReact
// properties
columnDefs={columnDefs}
rowData={rowData}
reactNext={true}
// events
onGridReady={onGridReady}>
</AgGridReact>
</div>
)
}