Skip to content

API Reference

isLand

Checks if the code is running in the browser, or on the server.

MyIsland.tsx
import { isLand } from 'is-land'
export default function MyIsland() {
console.log(`Hello ${isLand() ? 'browser' : 'server'}!`)
return (
<>
<h1>Hello world!</h1>
<p>See the console for a message.</p>
</>
);
}

This method is also exposed as the default export.

is_land

Alias of isLand

island

Alias of isLand