You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
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?