JSFiddle - React, Tailwind, and code Playground
HTML
<div class="my-div">....</div>
JavaScript
let btn = document.createElement("BUTTON");
btn.innerHTML = "CLICK";
btn.id = "redirect-button";
document.getElementsByClassName('my-div')[0].appendChild(btn);
document.getElementById('redirect-button').addEventListener('click', () => window.location.href = "https://www.google.com");