Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

608 B
Raw Blame
/* Copyright 2026 Marimo. All rights reserved. */
import { type EffectCallback, useEffect } from "react";

/**
 * Wrapper around useEffect that makes it clearer that the effect is run, just on mount.
 */
export function useOnMount(effect: EffectCallback) {
  // oxlint-disable-next-line react-hooks/exhaustive-deps
  useEffect(effect, []);
}

/**
 * Wrapper around useEffect that makes it clearer that the effect is run, just on unmount.
 */
export function useOnUnmount(effect: EffectCallback) {
  // oxlint-disable-next-line react-hooks/exhaustive-deps
  useEffect(() => {
    return effect();
  }, []);
}