JSFiddle - React, Tailwind, and code Playground
HTML
<div id="myId" class="myClass" style="width:100px; height:120px; --rotation:-45deg;"></div>
CSS
.myClass{
background-color:red;
float:left;
--rotation: 45deg;
transform: rotate(var(--rotation));
margin:20px;
}
JavaScript
const cssText = document.getElementById('myId').style.cssText;
console.log(cssText);
const rotationProp = cssText.split("; ").find(style => style.includes("rotation"));
console.log(rotationProp);
const rotationValue = rotationProp.slice(rotationProp.indexOf(":") + 1, rotationProp.indexOf(";"));
console.log(rotationValue);