I am very new to React-redux applications development so I am trying to code simple worldcup app. Simply my code are;
class Teams extends Component {
componentDidMount() {
this.props.onRequestData();
}
renderTeams() {
const { team } = this.props;
console.log(team);
_.map(team, teamList =>
<Grid.Column
mobile={4}
tablet={8}
computer={8}
key={teamList.id} >
<Card >
<Image src={teamList.flag} />
<Card.Content>
<Card.Header>Nationality</Card.Header>
<Card.Description key={teamList.id}> {teamList.name} </Card.Description>
</Card.Content>
</Card>
</Grid.Column>
);
}
render() {
return (
<Container>
<Grid>
{this.renderTeams()}
</Grid>
</Container>);
}
}
const mapStateToProps = (state) => {
console.log("mapPropState", state);
return {
team: state.fetchData.teams
};
};
const mapDispatchToProps = dispatch => ({
onRequestData: () => dispatch(fetchResults())
});
I can see I fetch the data(with console.log("mapPropState", state) but unfortunately I guess my render method undefined. So nothings work on page and no console error. So where did i do wrong? Thank You.