Created
April 2, 2023 09:20
-
-
Save alex-streza/a6f3385c62d488f9350478d22f3a74da to your computer and use it in GitHub Desktop.
GSAP Context Hook for React
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const useGsapContext = ( | |
| func: gsap.ContextFunc, | |
| deps: any[] = [], | |
| target?: any, | |
| ) => { | |
| useEffect(() => { | |
| const ctx = gsap.context(func, target) | |
| return () => ctx?.revert() | |
| }, deps) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment