JSFiddle - React, Tailwind, and code Playground
HTML
<div class="switch"> Background changes upon the window location. </div>
JavaScript
var winLoc = "?rent_rooms=1234&search_rooms=";
//this is for jsFiddle purposes
//you'll replace the above with 'window.location.search'
winLoc = winLoc.replace('?', '').split('&');
var ourStr = winLoc[1].replace('=', '');
switch(ourStr){
case 'search_rooms':
$('.switch').css('backgroundColor', 'red');
break;
case 'search_housing':
$('.switch').css('backgroundColor', 'blue');
break;
}