Skip to content

Commit

Permalink
fix(useLocalStorage): Fixed type of setter
Browse files Browse the repository at this point in the history
  • Loading branch information
HHogg committed Jul 4, 2024
1 parent b119b56 commit ba4637a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion workspaces/package/src/hooks/useLocalStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useEffect, useState } from 'react';
function useLocalStorage<T>(
key: string,
initialValue: T
): [T, (state: T) => void];
): [T, (state: T | ((state: T) => void)) => void];
function useLocalStorage<T = undefined>(key: string, initialValue = undefined) {
const [storedValue, setStoredValue] = useState<T | undefined>(() => {
try {
Expand Down

0 comments on commit ba4637a

Please sign in to comment.