How to create private variables and methods using ES6 class which should be access by public methods of the same class.
class MyClass {
constructor() {
this.publicVar = "I am public";
//some private Variable e.g privteVar1 = "I am Private1"; privateVar2 = "I am Private2";
this.publicMethod = () => {
//it should have accesses to private variables and methods
console.log(privateVar1, privateVar2)
};
//similarly need to create some privateMethod
}
render() {
//it also should have access to the private variables
}
}