JSFiddle - React, Tailwind, and code Playground

by Manuel Souto Pico

HTML

<h1>
Bitcoin
</h1>
<button id="price">Refresh</button>

JavaScript

var XHR = new XMLHttpRequest();

XHR.onreadystatechange = function() {
	if (XHR.readyState == 4) {
  	if (XHR.status == 200) {
    	var rate = XHR.responseText;
      console.log(rate.bpi.USD.rate);
    } else {
    	console.log("There was a problem");
    }
  }
}

XHR.open("GET", "https://api.coindesk.com/v1/bpi/currentprice.json");
XHR.send();