import React, { Component } from "react" import { connect } from "react-redux" import { getData } from "../actions/index" import { getHillaryData } from "../actions/index" import { getTrumpData } from "../actions/index" export class Post extends Component { componentDidMount() { // this.props.getData() if (this.props.candidate === 'Hilary Clinton') { this.props.getHillaryData() } else { this.props.getTrumpData() } } render() { let cand = this.props.candidate === undefined ? 'Not set' : this.props.candidate return (
Candidate: {cand}
{el.created_at}
{el.text}