raddix

useClient

Determine whether the code is running on the client-side.

Installation

Install the custom hook from your command line.

npm i @raddix/use-client

Usage

import { useClient } from '@raddix/use-client'
export default function App() {
const isClient = useClient()
return(
<div>
<h6>Is Client? </h6>
<p>{isClient ? "Yes" : "No"}</p>
</div>
)
}

API

Returns

NameDescripciónTipo
isClienttrue if running in a client-side environment, false otherwise.boolean