Overriding a parent class instance (non-static) method javascript

Viewed 920

My use case is React, but this is a JavaScript question.

I'd like to extend the functionality of componentWillMount by using a subclass. How can I accomplish this?

class Super {
    componentWillMount() {
        doStuff()
    }
}
class Sub extends Super {
    componentWillMount() {
        super() // this doesn't work
        doMoreStuff()
    }
}
2 Answers
Related