react state not updating 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)