<div id="root"></div>
class App extends React.Component{

state = {
   todo:null
}


componentDidMount(){
  axios.get('https://jsonplaceholder.typicode.com/todos/1')
  .then(res=>{
      this.setState({
          todo:res.data
      })
  })
  .catch(err=>console.log(err))
}


    render(){
        return (
            <div>
            <h1>hello</h1>
            {this.state.todo ? <p>{this.state.todo.title}</p>:<p>Loading</p>}
            </div>
        )
    }

}

ReactDOM.render(<App/>,document.querySelector('#root'))
View Compiled
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.min.js
  2. https://cdnjs.cloudflare.com/ajax/libs/react/16.7.0/umd/react.production.min.js
  3. https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js