Sign in
Log inSign up

Is it necessary to always pass props to a constructor() and/or super() call in React?

Alex Yap's photo
Alex Yap
·May 6, 2018

I apologize for the noob question but this is my way of understanding a framework each time I learn a new one. From what little I know about React at the moment is I understand that we pass props to the constructor and super calls when the component making the call is going to receive props.

But what I don't understand is the many Youtube tutorials I have watched still pass props to the constructor and super calls even if the component is the 'parent-most' component or doesn't even receive any props altogether, let alone make use of it. Why do they do this?

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct