This problem might lay in React syntax that I do not understand well.
I have an array and I'm making Buttons with *array.maps((item) => * and I'm creating buttons as much as I have elements in the array. BUT I can not trigger/call any function with those buttons. I press those buttons but nothing happens. Any idea why?
in parent's class:
class ParentClass extends Component{
constructor(props){
super(props);
this.state = {
someObjectXX: {
someArrayZZ: ['first', 'next', 'anything']
}
}
}
render{
return(
<ChildClass someObjectXX={this.state.someObjectXX} />
)
}
}
in child's class:
class ChildClass extends Component{
sayGoodbye = () => {
alert("scream if it works ^_^ ");
}
render{
return (
<div>
{this.props.someObjectXX.someArrayZZ.map((item) => {
return (
<Row key={number} >
<Button text={shortName} handler={this.sayGoodbye} />
</Row>
)
})}
</div>
)
}
}