click(e){
console.log(e.altKey);
let unit = this.state.array;
}
render() {
let array = this.state.array;
let unit = array.map((item, index) => {
return (
<a key={index}
style={{display:"block"}}
onClick={this.click.bind(this)}
>Hello, {item}</a>
)
});
сlick(e, item) {
console.log(item);
}
render() {
const { array } = this.state;
const unit = array.map((item, index) => (
<a
key={index}
style={{display:"block"}}
onClick={(e) => this.click(e, item)}
>
Hello, {item}
</a>
));
click(e, index){
console.log(e.altKey);
let unit = this.state.array;
}
render() {
let array = this.state.array;
let unit = array.map((item, index) => {
return (
<a key={index}
style={{display:"block"}}
onClick={(e)=>this.click(e, index)}
>Hello, {item}</a>
)
});