for some reason the value of my setState is not updating when I press the next button. It is for a progress bar where the progress bar adds 20 each time the button is pressed. So like value:this.state.value+20 Does anyone know whats going on? Any help is appreciated. Thanks!
import React, {Component} from "react";
import { Button, Progress } from 'reactstrap';
import "../src/Questions.css"
class Questions extends React.Component {
handleClick=()=>{
alert(this.state.value);
this.setState({
value:this.state.value +20
})
}
render() {
this.state = {
value:10
}
return(
<div>
<div><Progress value={this.state.value} /></div>
<div className="howMuchText">How much does it cost to build an app</div>
<div className="nextButton">
<Button onClick={this.handleClick} color="primary" size="lg">Next</Button>
</div>
</div>
)
}
}
export default Questions;