What's the difference between "super()" and "super(props)" in React when using es6 classes?
@lebyy▲ 0 net votes
Problem: When is it important to pass props to super() , and why? class MyComponent extends React.Component { constructor(props) { super(); // or super(props) ? } } Fix (from the top answer): There is only one reason when one needs to pass props to super() : When you want to access this.props in constructor. Passing: class MyComponent extends React.Component { constructor(props) { super(props) console.log(this.props) // -> { icon: ' Not passing: class MyComponent extends React.Component {…