Skip to content

Commit

Permalink
Fix(useFlip): prevent registerPlugin from running on server
Browse files Browse the repository at this point in the history
  • Loading branch information
evertmonk committed Jan 18, 2024
1 parent 04a845b commit 1873f60
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/gsap/hooks/useFlip/useFlip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import Flip from 'gsap/Flip';
import { useEffect, useRef, type MutableRefObject } from 'react';
import { unref, type Unreffable } from '../../../utils/unref/unref.js';

gsap.registerPlugin(Flip);
if (typeof window !== 'undefined') {
gsap.registerPlugin(Flip);
}

export function useFlip(
ref: Unreffable<HTMLElement | null>,
Expand Down

0 comments on commit 1873f60

Please sign in to comment.