Answer the question
In order to leave comments, you need to log in
setstate error?
Hello guys!
I have a problem that I can't edit values using setstate.
The number (speed to value) should be added, but nothing happens ((
I tried everything I could, I don’t understand what the problem is - https://codesandbox.io/s/9j466y4rlp .
Thanks in advance!
Answer the question
In order to leave comments, you need to log in
why is it not added, if you write console.log('render', this.state) in the render,
then it will be value: 60
-
in the timeout, you need to add value, and not in componentDidMount?
this is how the "nanobar" is filled
this.timeout = setInterval(() => {
this.setState({ value: this.state.value + this.props.speed });
this.nanobar.go(this.state.value);
}, 1000);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question