好了,所以我想要做的是:ES6调用扩展组件功能
我延长反应,照片画廊成分,它有这个功能openLightbox,我想做些别的事情在我的组件当这个功能被触发时,我尝试了这样的事情:
import React, { Component } from 'react';
import { FormattedMessage } from 'react-intl';
import Gallery from 'react-photo-gallery';
export class GaleryComponent extends Gallery {
constructor(props) {
super(props);
this.openLightBox = this.openLightBox.bind(this);
}
openLightbox() {
console.log("LIGHTBOX OPENED");
}
}
这样做的正确方法是什么?
WTH是'this.openLightbox = super.openLightbox'应该做的吗?这覆盖了原有的覆盖方法。 – Bergi