JSFiddle - React, Tailwind, and code Playground

HTML

<form>
  <input type="color" value="" id="favcolor">
</form> 

<p id="hex"></p>

JavaScript

var theInput = document.getElementById("favcolor");
    var theColor = theInput.value;
    theInput.addEventListener("input", function() {
    
    document.getElementById("hex").innerHTML = theInput.value;
    }, false);