Skip to content

useWasSSR

Indicates whether the component was SSR'ed or not.

The useWasSSR hook is helpful when you want to know whether the component was server-side rendered (SSR) or not.

useWasSSR

SSR'ed
Client Only

Usage

Import the hook from @abhushanaj/react-hooks and use in required component.

./src/App.tsx
import { useWasSSR } from '@abhushanaj/react-hooks';
function App() {
const wasSSR = useWasSSR();
return (
<div>
<p>{useWasSSR ? 'Yes' : 'No'}</p>
</div>
);
}
export default App;

API Reference

Return Value

ParameterTypeDescriptionDefault
wasSSRbooleanWhether or not the component was server rendered.N/A