React Class Components: State
Learn how to set state for a react class component.
We'll cover the following
Before React Hooks, class components were superior to function components because they could be stateful. With a class constructor, we can set an initial state for the component. Also, the component’s instance (this
) gives access to the current state (this.state
) and the component’s state updater method (this.setState
):
Get hands-on with 1400+ tech skills courses.