The useReplitEffect() hook fires a callback with the replit API wrapper upon the first component render and when its dependency array changes. It is similar in functionality to the useEffect React hook.
useReplitEffect()
replit
useEffect
import { useReplitEffect } from '@replit/extensions-react'; const Component = () => { useReplitEffect(async (replit) => { ... }, [...dependencies]); ... }
function useReplitEffect( callback: (typeof replit) => Promise<void>; dependencies: Array<any> ): null;
Was this page helpful?