I'm learning ES6, I just want to convert my ES5 knowledge to ES6.
here's my ES5 code:
function click() {
this.className += ' grab';
setTimeout(() => (this.className = 'remove'), 0);
};
and here's my ES6 code:
const click = () => {
this.className += ' grab';
setTimeout(() => (this.className = 'remove'), 0);
console.log('RENDERING');
}
My problem is this.className += ' grab'; and setTimeout(() => (this.className = 'remove'), 0); didn't run the function. But console.log shows on the log.
Is this method don't work on arrow functions?