import React, { Component } from 'react';
import { connect } from 'react-redux';
import { drizzle } from '../index';
import Topic from './Topic';
const contract = "Forum";
const getTopicMethod = "getTopic";
class TopicList extends Component {
constructor(props) {
super(props);
this.getBlockchainData = this.getBlockchainData.bind(this);
this.dataKeys = [];
}
getBlockchainData(){
if (this.props.drizzleStatus['initialized']){
this.props.topicIDs.forEach( topicID => {
if (!this.dataKeys[topicID]) {
this.dataKeys[topicID] = drizzle.contracts[contract].methods[getTopicMethod].cacheCall(topicID);
}
})
}
}
render() {
const topics = this.props.topicIDs.map((topicID) => {
return (