develop
useSSR
A custom hook to know where the code will be executed.
This hook returns whether the code is executed in the Server (Server-Side-Rendering) or Client side (Browser).
Usage
import { useSSR } from "@wonderflow/react-components";
export default () {
const { isBrowser, isServer } = useSsr();
return (
<div>
<p>{isBrowser ? 'Client' : 'Server'}</p>
<p>{isServer ? 'SSR' : 'Browser'}</p>
</div>)
}Return value
VALUE
TYPE
DESCRIPTION
isBrowserbooleanTrue when code runs Client side
isServerbooleanTrue when code runs on the Server