Reputation: 77
I am learning from scratch react jsx. I have no previous learning of java or html language.
I've been searching what is it for the constructor() and super(). This are components? Anyone can explain me everything about this 2 things.
Upvotes: 1
Views: 80
Reputation: 1274
If you are new to Javascript diving straight into a framework probably isn't a good idea. I would recommend using the classes on codecademy to get a basic understanding of how Javascript works, then you can either do the React classes or go and try to learn it yourself, but you should definitely do the javascript class just to learn the basic language features.
Upvotes: 2
Reputation: 4939
These are clearly explained on the Mozilla Developer Network for JavaScript
The constructor method is a special method for creating and initializing an object created with a class. There can only be one special method with the name "constructor" in a class. A SyntaxError will be thrown if the class contains more than one occurrence of a constructor method.
The super keyword is used to access and call functions on an object's parent. The super.prop and super[expr] expressions are valid in any method definition in both classes and object literals.
Upvotes: 3