Skip to content

Commit

Permalink
fix casing
Browse files Browse the repository at this point in the history
  • Loading branch information
chaance committed Aug 21, 2024
1 parent b5ed6b3 commit 7ebb210
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion utils/can-use-dom.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const canUseDom = !!(
export const canUseDOM = !!(
typeof window !== 'undefined' &&
window.document &&
window.document.createElement
Expand Down
4 changes: 2 additions & 2 deletions utils/use-layout-effect.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { canUseDom } from './can-use-dom';
import { canUseDOM } from './can-use-dom';

const noop = () => {};
export const useLayoutEffect = canUseDom ? React.useLayoutEffect : noop;
export const useLayoutEffect = canUseDOM ? React.useLayoutEffect : noop;
8 changes: 4 additions & 4 deletions utils/use-local-storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import * as React from 'react';
import type { Dispatch, SetStateAction } from 'react';
import { useEffectEvent } from './use-effect-event';
import { canUseDom } from './can-use-dom';
import { canUseDOM } from './can-use-dom';

/**
* Options for customizing the behavior of serialization and deserialization.
Expand Down Expand Up @@ -65,7 +65,7 @@ export function useLocalStorage<T>(
const initialValueToUse = initialValue instanceof Function ? initialValue() : initialValue;

// Prevent build error "window is undefined" but keep working
if (!canUseDom) {
if (!canUseDOM) {
return initialValueToUse;
}

Expand All @@ -90,7 +90,7 @@ export function useLocalStorage<T>(
// ... persists the new value to localStorage.
const setValue: React.Dispatch<SetStateAction<T>> = useEffectEvent((value) => {
// Prevent build error "window is undefined" but keeps working
if (!canUseDom) {
if (!canUseDOM) {
console.warn(
`Tried setting localStorage key “${key}” even though environment is not a client`
);
Expand All @@ -116,7 +116,7 @@ export function useLocalStorage<T>(

const removeValue = useEffectEvent(() => {
// Prevent build error "window is undefined" but keeps working
if (!canUseDom) {
if (!canUseDOM) {
console.warn(
`Tried removing localStorage key “${key}” even though environment is not a client`
);
Expand Down

0 comments on commit 7ebb210

Please sign in to comment.