Is there a way to dynamically update the x and y position based on user clicks, and then apply these changes to the top and left properties of a div?
.dataCardAbsolute {
position: absolute;
top: 100px;
left: 300px;
overflow: auto;
}
React.useEffect(() => {
document.body.addEventListener('click', (event) => { setPosition([event.pageX, event.pageY]) })
}, []);
<div
className={{styles.`dataCardAbsolute-${}`}} //trying to figure it out...
className={styles.dataCardAbsolute}
>
Can anyone suggest a method for sending the updated position values to the CSS file?