What does calling super() in a React constructor do?

Learning React from the docs and came across this example:

class Square extends React.Component {
  constructor() {
    super();
    this.state = {
      value: null,
    };
  }
  ...
}

According to Mozilla, super allows you to use this in the constructor. Is there any other reason to use a stand alone super (I know super allows you to access parent class’s methods as well) but with React is there any other use case of just calling super() by itself?

59 thoughts on “What does calling super() in a React constructor do?”

  1. 891696 478993I discovered your weblog post web site on the search engines and appearance several of your early posts. Always preserve the top notch operate. I additional the Feed to my MSN News Reader. Seeking forward to reading a lot far more on your part down the line! 979646

    Reply
  2. Wonderful site you have here but I was curious if you
    knew of any community forums that cover the same
    topics talked about in this article? I’d really love to be a part of online community where I can get comments from other experienced individuals that share the same interest.
    If you have any suggestions, please let me know.
    Thanks a lot!

    Reply
  3. Heya i am for the first time here. I came across this
    board and I in finding It truly helpful & it helped me out much.
    I hope to give one thing back and help others like you helped me.

    Reply
  4. I really like your blog.. very nice colors & theme. Did you make this
    website yourself or did you hire someone to do it for you?
    Plz reply as I’m looking to design my own blog and would like to find out where u got this
    from. many thanks

    Reply
  5. Does your site have a contact page? I’m having problems locating it but, I’d
    like to shoot you an e-mail. I’ve got some creative ideas
    for your blog you might be interested in hearing. Either way, great blog and I
    look forward to seeing it grow over time. ps4 games https://j.mp/3nkdKIi ps4

    Reply
  6. Please let me know if you’re looking for a article writer for your site.
    You have some really great posts and I believe I would be a good asset.

    If you ever want to take some of the load off, I’d absolutely love to write some material for your blog in exchange for a link back to mine.
    Please shoot me an email if interested.
    Thank you!

    Reply

Leave a Comment