15 hours ago
- In JavaScript, calling `super()` is required in a class constructor before using `this`; React class components inherit this rule.
- Passing `props` to `super(props)` is not strictly necessary because React assigns `this.props` after the constructor runs, but it ensures `this.props` is available during the constructor.
- The `super(props)` convention prevents confusion and bugs, especially when methods are called from within the constructor.
- React's constructor also receives `context` as a second argument, but it's less commonly used.
- Class fields proposal and Hooks eliminate the need for explicit `super()` calls in many cases.