821 B
821 B
The isClient
utility is a function that returns a boolean indicating
if the code was run on the client.
Arguments
None
Return type
A boolean
indicating if the code was run on the client.
Example code
import {isClient} from '@shopify/hydrogen/client';
export function MyComponent() {
if (isClient()) {
return <p>I ran on the client</p>;
}
return <p>I ran on the server</p>;
}