I
I
Isaac Clark2015-10-07 14:02:41
React
Isaac Clark, 2015-10-07 14:02:41

React.js: Why doesn't click fire?

Here is the code:

return brandName.map(function (item, i) {
            return (<li onClick={this.check} key={i}><a href="#">{item}</a></li>);
        }.bind(this));

The problem is that check does not work. brandName is an array with item names.
if I add a click to remove position:absolute, then everything works. why? what's the problem in position ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vpolotskiy, 2015-10-07
@vpolotskiy

onClick should be placed on a link, i.e. on "a"

return brandName.map(function (item, i) {
            return (<li key={i}><a onClick={this.check} href="#">{item}</a></li>);
        }.bind(this));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question