Writing to a variable defined outside a component or hook is not allowed. Consider using an effect

With the new react compiler, I have a few Writing to a variable defined outside a component or hook is not allowed. Consider using an effect an example of something triggering this is
const onSomeEvent = () => {
document.body.style.overflow = showMobileFilters ? "auto" : "hidden";
};
const onSomeEvent = () => {
document.body.style.overflow = showMobileFilters ? "auto" : "hidden";
};
What is the suggested way to solve this?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server