To read a component’s state, use the expression this.state.name-of-property:

class TodayImFeeling extends React.Component { constructor(props) { super(props); this.state = { mood: 'decent' }; } render() { return ( <h1> I'm feeling {this.state.mood}! </h1> ); } }

The above component class reads a property in its state from inside of its render function.

Just like this.props, you can use this.state from any property defined inside of a component class’s body.



In App.js, get rid of the text inside of the <h1></h1>.

Instead, in between the <h1></h1> tags, read your state‘s title property.


At the bottom of the file, render <App /> using ReactDOM.render().

See your component’s state on display. Truly, you have the best of apps.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?