UNPKG

@inkline/paper

Version:

Paper is a unified interface for defining components for Vue and React using a single code base.

12 lines (11 loc) 276 B
import { useEffect, useRef } from "react"; export const watch = (dependency, callback) => { const mounted = useRef(false); useEffect(() => { if (!mounted.current) { mounted.current = true; return; } callback(dependency()); }, [dependency()]); };