Preferably 1 line code in the constructor.
I don't want to console.log() on every callback of setState
Is there some listener for changes?
Preferably 1 line code in the constructor.
I don't want to console.log() on every callback of setState
Is there some listener for changes?
 
    
    Use the componentDidUpdate lifecycle function to show the state change:
  componentDidUpdate(prevProps, prevState) {
   console.log(prevState, this.state);
  }
For detecting the actual change use deep object comparison.
Working Codesandbox example .
