Is there a way of changing the following, so that I don't use the .bind(this, ..
. A lot of the time I usually just do this.onClickTabItem
but I'm guessing when passing a parameter this can't be done? (Not 100% sure why this is)
Ideally I would like something like this.handleClick(index)
handleClick= (index) => {
this.setState({ active: index })
}
return (
...
onClick={this.handleClick.bind(this,index)}
...
)
Below is how I render
getContent() {
const { ... } = this.props;
return (
<Styled1>
{tabs.map((tab, index) => {
return (
<Styled2
...
...
onClick={this.handleClick.bind(this,index)}
>
...
</Styled2>
)
})}
</Styled1>
);
}
render() {
return (
{this.getContent(()}
);
}