I have a React component
export default class Archive extends React.Component {
...
}
componentDidMount
and onClick
Another way:
export default class Archive extends React.Component {
saySomething = (something) => {
console.log(something);
}
handleClick = (e) => {
this.saySomething("element clicked");
}
componentDidMount() {
this.saySomething("component did mount");
}
render() {
return ;
}
}
In this format you don't need to use bind