JavaScript React Basics Understanding State Understanding State Review

Charlie Prator
.a{fill-rule:evenodd;}techdegree seal-36
Charlie Prator
Front End Web Development Techdegree Graduate 19,852 Points

What does the exclamation point in this code stating?

confirmGuest = () => {
  this.setState( prevState => ({ 
    isConfirmed: !_________.isConfirmed

Is the above saying to update the state of isConfirmed through the negation of its previous state? So, if the previous state of isConfirmed is false, then we're changing it to true with the exclamation point, right?

1 Answer

yes!... just toggling the value of isConfirmed

isConfirmed: !prevState.isConfirmed