Skip to content

Commit

Permalink
Merge pull request #3 from maximousblk/main
Browse files Browse the repository at this point in the history
fix: reference error while server side rendering
  • Loading branch information
tol-is authored Jan 29, 2023
2 parents 77ec8b3 + 9c93e3f commit 08efa03
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,10 @@ export const useScramble = (props: UseScrambleProps) => {
ignore = [' '],
} = props;

const prefersReducedMotion = window.matchMedia(
'(prefers-reduced-motion: reduce)'
).matches;
const prefersReducedMotion =
typeof window !== "undefined"
? window.matchMedia("(prefers-reduced-motion: reduce)").matches
: false;

if (prefersReducedMotion) {
step = text.length;
Expand Down

0 comments on commit 08efa03

Please sign in to comment.