JSFiddle - React, Tailwind, and code Playground

SCSS

body {
  &:before {
    content: 'SM';
  }
}

@media (min-width: 768px) {
	body {
		&:before {
    }
	}
}

@media (min-width: 1024px) {
	body {
		&:before {
    }
	}
}

JavaScript

var checkContentValue = function() {
		return window.getComputedStyle(document.body, ':before')
			.getPropertyValue('content').replace(/"/g, '');
}

var doSomething = function() {
  if (checkContentValue() === 'SM') {
    return 'SM';
  } else if (checkContentValue() === 'MD') {
    return 'MD';
  } else {
    return 'LG';
  }
};

console.log(doSomething());

window.addEventListener('resize', function() {
	console.log(doSomething());
})