A
A
Alex Polyakh2017-06-20 15:11:45
JavaScript
Alex Polyakh, 2017-06-20 15:11:45

Is it possible to explain in simple words, super, constructor inside the class?

ReactJS example:
class App extends Component{
constructor (props) {
super(props)
}
}
Thanks!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Eremin, 2017-06-20
@PolyakhAleksandr

class App extends Component{ //вот тута мы говорим, что App - наследник от Component
constructor (props) { // конструктор App
   super(props) //обязательно нужно сначала выполнить логику в конструкторе родителя
 /* потом конструктор можно будет дополнить своей логикой */
   }
}

I
IceJOKER, 2017-06-20
@IceJOKER

I guess it's a call to the parent's constructor

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question