JSFiddle - React, Tailwind, and code Playground
HTML
<div id="div1">div1</div>
<div id="div2">div2</div>
JavaScript
document.addEventListener('DOMContentLoaded', () => {
//if (test) {
document.getElementById('div1').style.display = 'block';
document.getElementById('div2').style.display = 'none';
//}
});