20 lines
488 B
TypeScript
20 lines
488 B
TypeScript
'use client'
|
|
import { useGSAP } from '@gsap/react'
|
|
import gsap from 'gsap'
|
|
import { createContext, useContext, type ReactNode } from 'react'
|
|
|
|
gsap.registerPlugin(useGSAP)
|
|
const GsapContext = createContext<typeof globalThis.gsap | null>(null)
|
|
|
|
export function useGsapContext() {
|
|
return useContext(GsapContext)
|
|
}
|
|
|
|
export default function GsapProvider({children}:{children:ReactNode}) {
|
|
return (
|
|
<GsapContext.Provider value={gsap}>
|
|
{children}
|
|
</GsapContext.Provider>
|
|
)
|
|
}
|