Setstate curriculum

What is the difference between
this.setState({visibility:!this.state.visibility})
and this:

this.setState(state=>({visibility:!state.visibility}))

The second version is guaranteed to have the latest value of the state property visibility. It is highly recommended to use the second version whenever the state property you are setting is based on itself. React’s setState method is asynchronous and does not guarantee the value of the state property (i.e this.state.propName) will reflect the most current value unless the functional version is used.