JSFiddle - React, Tailwind, and code Playground
HTML
<div style="border: 1px solid blue;">
Area 1 (for example a sidebar)
<gcse:searchbox></gcse:searchbox>
</div>
<div style="border: 1px solid red;">
Area 2 (for example main area of the page)
<gcse:searchresults></gcse:searchresults>
</div>
JavaScript
// Make sure in jsFiddle you have selected option onLoad.
(function() {
var cx = '017643444788069204610:4gvhea_mvga'; // Insert your own Custom Search Engine ID here
var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true;
gcse.src = (document.location.protocol == 'https' ? 'https:' : 'http:') +
'//www.google.com/cse/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s);
})();