useIsClient

Check if the code is running on the client.

https://www.shaktools.com/shak-hooks
Utility

API Reference

Installation

terminal
pnpm add @shak-hooks/usehooks
import.ts
import { useIsClient } from "@shak-hooks/usehooks";
Source: packages/react/src/useIsClient.ts

Signature

signature.ts
export function useIsClient()

Parameters

No parameters.

Returns

unknown

Implementation

use-is-client.ts
1import { useState, useEffect } from "react";
2
3export function useIsClient() {
4 const [isClient, setIsClient] = useState(false);
5
6 useEffect(() => {
7 setIsClient(true);
8 }, []);
9
10 return isClient;
11}

Advertisement

Google Ads

Usage

example.tsx
1import { useIsClient } from "@shak-hooks/usehooks";
2
3const result = useIsClient();
4// result: unknown
5// Use values directly (React state).

Let‘s do great work together

Empowering creators with free, high-performance AI, SEO, and developer tools. Join thousands of users optimizing their workflow with Shak-Tools.

Tools10+ Free
UsersGlobal

Stay in the loop

Join our newsletter for the latest AI tools and updates.

ShakTools
© 2025 Shaktools. All Rights Reserved.Privacy Policy