JSFiddle - React, Tailwind, and code Playground

by calder12

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js"></script>
<div id="main">
  <h1>
  Star Wars
  </h1>
</div>

JavaScript

// ES6 requires a transpiler like Babel

let el = document.getElementById('main')

axios.get('https://swapi.co/api/people/1')
  .then( response => {
  	el.innerHTML = el.innerHTML + '<p>' + response.data.name + '</p>'
  })
  
  //ES5 will just work in any browser
  
var el1 = document.getElementById('main')

axios.get('https://swapi.co/api/people/6')
  .then( function(response) {
  	el1.innerHTML = '<p>' + response.data.name + '</p>' + el1.innerHTML
  })