0

I'm learning ReactJS. I figured that now the best way create a component is extending the class React.Component. My question is, what is this super(props) doing exactly?

I thought that it may be setting the basic props object, but if I delete the whole constructor method, it still works.

props reactjs

user1869935
  • 717
  • 2
  • 10
  • 23
  • See [Javascript: What's the difference between .call() and super()?](http://stackoverflow.com/q/38034059/1529630), [what does super() do with any arguments?](http://stackoverflow.com/q/39822941/1529630) and probably there is a better duplicate. – Oriol Oct 06 '16 at 22:47
  • 1
    See also http://stackoverflow.com/q/30571875/1048572 – Bergi Oct 06 '16 at 22:51
  • If you delete the whole constructor, the default constructor will pass all arguments through to `super(…)` – Bergi Oct 06 '16 at 22:51

1 Answers1

-1

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/super

Super calls constructor of parrent class and it's required in constructor of class that 'extends' from another class.

tauruss85
  • 3
  • 3