What is the purpose of super(props)?

Technology CommunityCategory: ReactWhat is the purpose of super(props)?
VietMX Staff asked 3 years ago

A child class constructor cannot make use of this until super() has been called. Also, ES2015 class constructors have to call super() if they are subclasses. The reason for passing props to super() is to enable you to access this.props in the constructor.