@otterlord/is-land
v0.1.0
Published
Determine if your code is running in the browser, or on the server.
Downloads
4
Maintainers
Readme
@otterlord/is-land
Detect if your Astro island is running in the browser, or on the server.
Example
@otterlord/is-land
is most useful on Astro islands hydrated using client:load
.
---
import MyIsland from '~/components/MyIsland.tsx'
---
<MyIsland client:load>
Import the @otterlord/is-land
package, and call it to check if your running in the browser.
import { h } from 'preact'
import isLand from '@otterlord/is-land'
export default function MyIsland() {
if (isLand()) alert('Hello browser!')
return (
<h1>Hello world!</h1>
);
}