react state does not update immediately 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)