Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
import { type DependencyList, useEffect, useRef } from "react";
export const useDebouncedEffect = (effect: () => void | Promise<void>, delay: number, deps: DependencyList): void => {
const effectRef = useRef(effect);
effectRef.current = effect;
useEffect(() => {
const timeout = window.setTimeout(() => {
void effectRef.current();
}, delay);
return () => {
window.clearTimeout(timeout);
};
}, [delay, ...deps]);
};