How to get this class inside a class method without resorting to bind? Because this method needs your this.

For example:

export default class test extends Component { constructor() { this.state = { loaded: false }; } getParentThis() { //Принимает из вне элемент, к которому мы можем обратиться через this, но так же нам нужно свойство loaded console.log(this.state); //Если не сделать bind в вызове функции, показывает undefined, но если сделать, теряется переданный элемент } } 
  • Which item? Is there an example? Your code doesn't show that you need your this - Nick
  • In any case there are only two ways, the first bind, and the second to create a property whose value will be a switch function in which the method you need will be called. The naturally exploring method is re-qualified as “private”, and the property is “public”. - user220409

0