@ffsm/snapshot
Version:
React snapshot utilities for capturing and measuring DOM elements
2 lines (1 loc) • 439 B
JavaScript
import{jsx as t}from"react/jsx-runtime";import{forwardRef as r,useCallback as o}from"react";import{useSnapshot as n}from"./use-snapshot.esm.js";const e=r(function(r,e){const{options:c,...i}=r,{onSnapshot:s=()=>{},...p}=c||{},m=n(s,p),f=o(t=>{"function"==typeof e?e(t):e&&"object"==typeof e&&"current"in e&&(e.current=t),m.current=t},[e,m]);return t("div",{...i,ref:f,children:r.children})});e.displayName="Snapshot";export{e as Snapshot};