ので私がやろうとしていることである: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