# useIsSSR



## Introduction

`useIsSSR` returns `true` during server rendering and hydration, and updates to `false`
immediately after hydration. This can be used to ensure that the server rendered HTML
and initially hydrated DOM match, but trigger an additional render after hydration to
run browser-specific code. For example, it could be used to run media queries or feature
detection for browser-specific APIs that affect rendering but cannot be run server side.

In React 16 and 17, this hook must be used in combination with the [SSRProvider](SSRProvider.md) component
wrapping your application. See the [server side rendering](ssr.md) docs for more information.

## Example

```tsx
import {useIsSSR} from '@react-aria/ssr';

function MyComponent() {
  let isSSR = useIsSSR();
  return <span>{isSSR ? 'Server' : 'Client'}</span>;
}
```

## API

<FunctionAPI
  function={docs.exports.useIsSSR}
  links={docs.links}
/>
