selector {
    will-change: /* value */
}
  .box {
    width: 100px;
    height: 100px;
    background-color: red;
    transition: transform 0.3s;
  }
  .box:hover {
    will-change: transform;  /* Ineffective use */
    transform: scale(1.2);
  }
.box {
    width: 100px;
    height: 100px;
    background-color: red;
    transition: transform 0.3s;
    will-change: transform;
}
.box.optimized {
    transform: scale(1.2);
}
<div class="box"></div>
// Add the optimization class after the page has loaded
window.addEventListener('load', () => {
    const box = document.querySelector('.box');
    box.classList.add('optimized');
});
// Get the element to animate on interaction
const el = document.getElementById('element');

// Set the will-change hint on mouseenter
el.addEventListener('mouseenter', hintBrowser);

// Remove the hint once the animation ends
el.addEventListener('animationend', removeHint);

function hintBrowser() {
    // Tell the browser to prepare for transform and opacity changes
    this.style.willChange = 'transform, opacity';
}

function removeHint() {
    // Revert to default to release resources
    this.style.willChange = 'auto';
}