1

Whats the difference between this.setState({name: 'xyz'}) vs Normal value assignment this.state.name='zyx'

// SetStateReact way of setting
tick = () => {
    this.setState({
        date: new Date()
    });
}

// Normal assignment
tick = () => {
    this.state.date= new Date();
}
Ivan Leonenko
  • 2,363
  • 2
  • 27
  • 37
  • 8
    The question should already be answered here ► [What the difference of this.state and this.setstate in ReactJS?](http://stackoverflow.com/questions/35867038/what-the-difference-of-this-state-and-this-setstate-in-reactjs) – Nope Feb 10 '17 at 17:03
  • Yes that answers what i wanted . Thanks @Fran – Arun Kumar M S Feb 10 '17 at 17:12

0 Answers0