isServer & isClient

Overview

very simple helper functions to determine if the code is running on the server or the client.

export const isServer = () => typeof window === "undefined";

export const isClient = () => !isServer();