UNPKG

@clubmed/trident-ui

Version:

Shared ClubMed React UI components

29 lines (28 loc) 470 B
import { useState as x, useEffect as E } from "react"; function S({ name: p, initialValue: s, onChange: u, defaultValue: f = "", formatter: c = (e) => e }) { const [e, o] = x(c(s || f)); E(() => { s !== void 0 && o(c(s)); }, [s]); function r(t) { t = c(t), o(t), u && u(p, t); } function v() { o(f); } return { value: e, setValue: r, resetValue: v }; } export { S as useValue }; //# sourceMappingURL=useValue.js.map