I am trying to tie the key ( called “divkey” in my application) to an onClick event when the user clicks a square in the grid ( in order to change its color). Nothing I’ve tried seems to work.
That is one of the bizillion combinations of code I’ve tried this morning. Just tried it again just exactly as what you wrote. Still getting “undefned” in Console.
It does not look like ActionBox has a state? Do you want this to refer to another component?
EDIT: Ah! I think I see the confusion. When you pass this.state.currentData[x] you are only passing the value, not a reference to the state. I believe you can do this:
Yup, tried that as well. I get your point and I tried that exact same thing earlier… But for some reason that approach actually breaks the entire application and nothing renders!
This makes it so that anytime you call handleClick it is already bound. I don’t know how to call the constructor (suspect componentDidMount or componentWillMount would work too) without using the ES6 syntax, so I gave you sort of a hacky workaround