@visa/nova-react
Version:
Visa Product Design System Nova React library. Compatible with React ^19.
2 lines (1 loc) • 475 B
JavaScript
import{useState as e,useEffect as o}from"react";function t(t,r,d){const[n,i]=e(d??t),l=t??n,u=void 0!==l&&void 0!==r?r:e=>{i(e),r?.(e)};return o(()=>{void 0!==t&&void 0===r&&console.warn("useModel","When using this hook it is required to provide both controlledValue and controlledSetter or neither. It could cause unintended side effects if one but not the other is provided.",`controlledSetter: ${r}`,`controlledValue: ${t}`)},[]),[l,u]}export{t as default,t as useModel};