Skip to content

Commit

Permalink
fix: strict equality in useLocalStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
danbiilee authored and juliencrn committed Jul 22, 2022
1 parent 856249a commit 2dc20df
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/src/useLocalStorage/useLocalStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function useLocalStorage<T>(key: string, initialValue: T): [T, SetValue<T>] {
// ... persists the new value to localStorage.
const setValue: SetValue<T> = useEventCallback(value => {
// Prevent build error "window is undefined" but keeps working
if (typeof window == 'undefined') {
if (typeof window === 'undefined') {
console.warn(
`Tried setting localStorage key “${key}” even though environment is not a client`,
)
Expand Down

0 comments on commit 2dc20df

Please sign in to comment.