I am new in reactjs, practicing some codes but getting some error on onclick function(Error is function is not executing), can anyone help to find out the error I have done, here is my code
import React, { Component } from "react";
class Hello extends Component {
constructor(props) {
super(props);
this.state = {
time: Date.now()
};
this.changeTime = this.changeTime.bind(this);
}
changeTime() {
alert('hi');
this.setState({
time: Date.now()
});
}
render() {
return (
<div>
<center>
<h3>Current Time : {this.state.time}</h3>
<br />
<button onlcick={this.changeTime}>Change Time </button>
</center>
</div>
);
}
}
export default Hello;