Practice
If you try to update state directly, the component will not re-render.
// Wrong
this.state.message = 'Hello world'
Instead, use the
// Correct
this . setState ({message : ' Hello World ' })
Note: You can assign the state object directly either in the constructor or by using the class field declaration syntax of the latest version of JavaScript.
Sign in and the lectures you have studied will be marked in this list.
Choose a course
Comments