DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Discussion on: Keeping track of on/off states of React components

Collapse
 
barryblando profile image
Barry⚑ • Edited on

Never forget to use prevState. πŸ‘

  onClick = i => {
    this.setState(prevState => ({
      clicked: !prevState.clicked
    }));
  }