Skip to content

Commit

Permalink
fix ssr build issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ayan4m1 committed Dec 14, 2023
1 parent 57a09a8 commit e2ed6f4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/hooks/useDarkMode.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useCallback, useEffect, useState } from 'react';
const mediaQuery = '(prefers-color-scheme: dark)';

const prefersDarkMode = () =>
window.matchMedia ? window.matchMedia(mediaQuery).matches : false;
typeof window !== 'undefined' ? window.matchMedia(mediaQuery).matches : false;

export default function useDarkMode() {
const [state, setState] = useState(prefersDarkMode());
Expand Down

0 comments on commit e2ed6f4

Please sign in to comment.