Skip to content

The open-source full-stack studio for Opus 5.5 motion video. Reverse engineering for any video. Code video with HTML: recreate, edit and render. BYOA + BYOK · Motion.md · Images, Video, Music & Voice.

645 B
Raw Blame
import { useEffect } from "react";

/**
 * Run an effect exactly once on mount (and optional cleanup on unmount).
 * This is the ONLY sanctioned way to call useEffect in this codebase.
 *
 * If you need to react to prop/state changes, use one of:
 * - Derived state (compute inline, no hook needed)
 * - Event handlers (onClick, onChange, etc.)
 * - `key` prop to force remount
 * - Data-fetching library (useQuery, useSWR)
 *
 * @see https://react.dev/learn/you-might-not-need-an-effect
 */
export function useMountEffect(effect: () => void | (() => void)) {
  // eslint-disable-next-line react-hooks/exhaustive-deps
  useEffect(effect, []);
}