We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8a949cd commit a88cf0bCopy full SHA for a88cf0b
src/pages/useLocalStorage.md
@@ -15,6 +15,9 @@ Sync state to local storage so that it persists through a page refresh.
15
Usage is similar to useState except we pass in a local storage key so that we can
16
default to that value on page load instead of the specified initial value.
17
18
+Since the local storage API isn't available in server-rendering environments,
19
+we check that `typeof window !== "undefined"` to make SSR and SSG work properly.
20
+
21
```jsx
22
import { useState } from "react";
23
0 commit comments