isServer
Edit this pageisServer is a constant boolean that indicates whether code is running in the server bundle.
Import
import { isServer } from "solid-js/web";Type
const isServer: boolean;Behavior
isServeristruein the server bundle andfalsein the browser bundle.- Because it is exported as a constant, bundlers can eliminate unreachable branches.
Examples
Basic usage
import { isServer } from "solid-js/web";
if (isServer) { serverOnlyWork();}