添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
挂过科的树叶  ·  PRAGMA key saved in ...·  1 周前    · 
挂过科的爆米花  ·  Message History :: ...·  1 周前    · 
纯真的围巾  ·  Research ...·  2 周前    · 
聪明的手电筒  ·  I cannot find my ...·  2 周前    · 
酷酷的日光灯  ·  Tenea Kouros · ...·  3 周前    · 
犯傻的单车  ·  The 10 Best Musical ...·  2 月前    · 

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I am using the mui x-data-grid and have one of its columns defined thus

field : "actions" , headerName : "Actions" , width : 130 , renderCell : ( cellValues ) => { return ( < DeleteIcon color = "primary" onClick = { ( event ) => { handleDeleteClick ( event , cellValues ) ; < EditIcon color = "primary" onClick = { ( event ) => { handleEditClick ( event , cellValues ) ; < / div >

The handleDeleteClick and handleEditClick functions are as follows

const handleDeleteClick = (event, cellValues) => {
    console.log(cellValues);
    axios
        .delete("http://localhost:3000/month", {
            data: {
                _id: cellValues.row.id,
        .then((res) => {
            history.go(0);
        });
const handleEditClick = (event, cellValues) => {
    const location = "/maintenance/" + {cellValues.row.id};
    history.push(location);

Both these functions are declared outside the functional component. Within the component I get a handle to the history object using useHistory hook.

const MyComponent = () => {
    const history = useHistory()

My issue is whereas history.go(0) works just fine the history.push call errors out saying history.push is not a function.
Why so?