我找到了答案(从这里改编:https ://gist.github.com/Zodiase/af44115098b20d69c531)-基类也需要以ES6方式定义:
class Hello extends React.Component {
//abstract getName()
getName()
{
if (new.target === Hello) {
throw new TypeError("method not implemented");
}
}
render() {
return <div>This is: {this.getName()}</div>;
}
};