Skip to content

Commit

Permalink
Merge pull request #301 from mediamonks/fix/use-flip-prevent-register…
Browse files Browse the repository at this point in the history
…plugin-on-server

Fix(useFlip): prevent registerPlugin from running on server
  • Loading branch information
leroykorterink authored Jan 18, 2024
2 parents 04a845b + 1873f60 commit 691b3a9
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 691b3a9

Please sign in to comment.