SSR Utilities API reference for server-side rendering utility functions server Guide

SSR Utilities

The SSR utilities provide constants for detecting whether the code is running on the server or client side.

Constants

isServer

const isServer

A boolean constant indicating whether the current environment is server-side.

Example

import { isServer } from '@semantic-ui/utils';
if (isServer) {
console.log("This code is running on the server");
} else {
console.log("This code is running in the browser");
}

isClient

const isClient

A boolean constant indicating whether the current environment is client-side (browser).

Example

import { isClient } from '@semantic-ui/utils';
if (isClient) {
document.addEventListener('DOMContentLoaded', () => {
console.log("DOM is fully loaded and parsed");
});
}