UNPKG

@ea-lab/reactive-json

Version:

A REACT-based lib that transforms JSON (or YAML) into interactive HTML markup.

23 lines (22 loc) 711 B
import { useContext as r, useEffect as l } from "react"; import { GlobalDataContext as c } from "../../engine/GlobalDataContext.js"; import { TemplateContext as u } from "../../engine/TemplateContext.js"; import { evaluateTemplateValue as i } from "../../engine/TemplateSystem.js"; const C = (e) => { const n = r(c), a = r(u), { attributesHolderRef: t } = e, { name: o } = e.actionProps || {}; return l(() => { if (!(t != null && t.current) || !o) return; const m = String( i({ valueToEvaluate: o, globalDataContext: n, templateContext: a }) ); t.current.removeAttribute(m); }, [o, n.data, a, t]), e.children; }; export { C as UnsetAttribute };