Skip to content

Commit

Permalink
docs(useLocalStorage): Clarify behavior when window is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
mturley committed Aug 10, 2022
1 parent ddbaef0 commit 6e93833
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/hooks/useLocalStorage/useLocalStorage.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ or if an error is thrown by the `localStorage` API, the error is caught and logg
back to the `defaultValue`.

`useLocalStorage` is safe to use in a server-side rendering or unit testing environment where `window.localStorage` is
not available. If `window` is undefined, the hook will simply always use the `defaultValue` and the setter function
will only update the cached value in React state.
not available. If `window` is undefined, the hook will simply act like a normal `useState` (only update the value cached
in React state).

## Examples

Expand Down

0 comments on commit 6e93833

Please sign in to comment.