I would like to have a code which updates the first entry in my array with a button click.
Does anyone have an idea what the solution could be?
Many thanks in advance,
Nicolas
I already tried the code attached.
class JobBuilder extends Component {
state = {
listings: {
accepted: [0,0,0,0,0,0,0,0,0,0]
}
}
acceptedHandler = () => {
const updatedCount = 1;
const updatedAccepted = {
...this.state.listings.accepted
}
updatedAccepted[1] = updatedCount;
}
render () {
return (
<Aux>
<JobList
listings={this.state.listings}
<button onClick={this.acceptedHandler}>Accept</button>
</Aux >
);
}
}