I am working on react js and import confirm modal from library but it does not allow me to user "this" within onOk() method
import {Modal} from "antd";
const confirm = Modal.confirm;
class Chat extends Component {
constructor(props){
this.state = {
}
this.deleteajax=this.deleteajax.bind(this);
this.deletemethod=this.deletemethod.bind(this);
}
deleteajax(){
// code for ajax
}
deletemethod(){
confirm({
title: 'Are you sure you want to delete this measureemnt?',
okText: 'Yes',
okType: 'danger',
cancelText: 'No',
onOk() {
this.deleteajax(id);
}
}
render(){
//some design for delete button
}
}