Currently I have this code implemented, but it seems to be causing an issue as it throws a "document is not defined" error.
export default function Modal() {
const [modal, setModal] = useState(false);
const toggleModal = () => {
setModal(!modal);
};
// THE ERROR OCCURS HERE
if (modal) {
document.body.classList.add('active-modal');
} else {
document.body.classList.remove('active-modal');
}