// You can initialize the state in the Component's constructor
this.state = { firstname: 'Maxence', age: 25 }
// You can get a state value with "this.state" property
this.state.firstname
// You MUST set some state value with "this.setState" method
// Be careful, this opereation might be asynchronous
this.setState({firstname: 'Mickaël'})Mounting:
constructor(props): Should starts withsuper(props); Perfect to initialize the state and binding methodsrender(): Return the JSX to displaycomponentDidMount(): Perfect place to call APIs and set up any subscriptions.
Updating:
Unmounting:
Error Handling:
On this Codepen, by using axios, display in the App component the information from this API: https://ih-crud-api.herokuapp.com/characters/1
