import React from 'react'; import { ListGroup, ListGroupItem } from 'reactstrap'; import { Link } from 'react-router-dom'; import strToSlug from '../StrToSlug' import '../css/Vegetables.css' export default class Map extends React.Component { constructor(props) { super(props); this.state = { selectedType: this.props.selectedType, selectedVegetable: this.props.selectVegetable } } componentWillReceiveProps(newProps) { this.setState(newProps); } render() { return (
{ this.state.selectedType && this.state.selectedType.Vegetables && this.state.selectedType.Vegetables.map((vegetable, key) => ( this.props.selectVegetable(vegetable)} > {vegetable.name} ) ) }
); } }