React 에서 Component를 생성할 때, stste 값을 초기화 하거나 메서드를 바인딩 할때 constructor()를 사용한다.

class sample extends React.Component {
	constructor(props) {
    	super(props);
        this.state = { isOn: true };
    };

};

React.class 를 구현할 때 super(props) 사용을 권고 하고 있다.

자바스크립트내에서 super는 부모 클래스의 생성자를 가르키게 된다.

super(props) 를 선언하지 않으면 constructor 에서 this키워드를 사용할 수 없게 된다.

그러나 어떠한 경우에는 super(props) 작성하지 않아도 render 메서드에서 this를 사용 가능하다. 하지만 생성자 내에서 정의되지 않을 경우 버그가 발생할 수있다. 그래서 super(props)의 사용을 권고 하고 있다.

하지만 hooks 를 사용하는 요즘에는 찾아보기 어렵다.