xxxxxxxxxx
class Foo {
constructor(name){
this.name = name
this.display = this.display.bind(this);
}
}
xxxxxxxxxx
ReactJS is based onjavascript, so the traditional OOP approach to `this`
is not the same.
When calling functions in class based components as opposed to functional
based components in ReactJS, you lose the `this` context on the object
and instead have it on the function itself.
You counter this behaviour through the useof `.bind()`, by using it
when you call the function, or in the constructor (preferred).