reactjs setstate not updating immediately oncgange code example
Example 1: setstate not updating state immediately
myFunction = () => {
this.props.updateItem(this.state)
}
Example 2: setstate not updating state immediately
this.setState({pencil:!this.state.pencil}, myFunction)