I'm Kent C. Dodds. I help people make the world better through quality software. Ask me anything!

View other answers to this thread
Mohd Shad Mirza's photo

What is your mental model around passing props inside super in a constructor? I do understand why but not enough to explain it to an absolute beginner. This question is inspired from Dan's "Just JavaScript" series.

Kent C. Dodds's photo

Hi Mohd,

I haven't really thought this through in a way to teach it to an absolute beginner. I think there are a lot of concepts I would need to teach an absolute beginner before we got to classes and inheritance. But the way I think about it is that if you want this thing to have the behavior of the parent, then you need to give the parent all the information it needs to do its job, which is why you call super.

I don't think I've explained that very well. I think I'd need to write a blog post or make a video to explain it adequately. Eventually I do plan to target more content toward beginner programmers. :)