UNPKG

@visa/nova-react

Version:

Visa Product Design System Nova React library. Compatible with React ^19.

2 lines (1 loc) 539 B
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");function t(t,o,r){const[d,i]=e.useState(r??t),n=t??d,s=void 0!==n&&void 0!==o?o:e=>{i(e),o?.(e)};return e.useEffect(()=>{void 0!==t&&void 0===o&&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: ${o}`,`controlledValue: ${t}`)},[]),[n,s]}exports.default=t,exports.useModel=t;