Here is my code looks like :
export default function FilterMenu() {
const [appState, setAppState] = useState({ loading: false, rows: [] });
const [FilteredData, setFilteredData] = useState({ loading: false, rows: [] });
const datasource = useEffect(() => {
setAppState({ loading: true, rows : [] });
const apiUrl = 'http://127.0.0.1:8000/api/requirement';
axios.get(apiUrl).then((rows) => {
setAppState({ loading: false, rows: rows.data });
console.log(rows)
rows = rows.data;
});
}, [setAppState]);
console.log(appState.rows)
return(
<>
<div className="search">
<TextField id="standard-basic" label="Search" style={{alignItems:'left'}}/>
</div>
<div style={{ height: 400, width: '95%', marginLeft:30}}>
<DataGrid AllowPaging="true" PageSize="8" OnPageIndexChanging="stockTakeGrid_PageIndexChanging" rows={appState.rows} columns={columns} pageSize={5} checkboxSelection/>
</div>
</>
);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…