Home › Forums › JavaScript › ReactJS – Trying to set state using time delay › Reply To: ReactJS – Trying to set state using time delay
April 12, 2016 at 6:10 am
#240474
tomek
Participant
Hi,
try this:
delayState: function() {
setTimeout(() => {
this.setState({
clicked: false
})
}, 2000);
},
I am using an arrow function here, so setTimeout
won’t carry its this
inside the body.