React component not re-rendering on state change

I’d like to add to this the enormously simple, but oh so easily made mistake of writing:

this.state.something = 'changed';

… and then not understanding why it’s not rendering and Googling and coming on this page, only to realize that you should have written:

this.setState({something: 'changed'});

React only triggers a re-render if you use setState to update the state.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)