JSFiddle - React, Tailwind, and code Playground
HTML
<button id="search">Search</button>
JavaScript
var q = "Testing google search";
document.getElementById('search').onclick = function() {
window.open('http://google.com/search?q='+q);
};
<button id="search">Search</button>
var q = "Testing google search";
document.getElementById('search').onclick = function() {
window.open('http://google.com/search?q='+q);
};