UNPKG

@onesy/ui-react

Version:
32 lines 644 B
import { c as _c } from "react/compiler-runtime"; import React from 'react'; import { is } from '@onesy/utils'; const useTabs = props => { const $ = _c(3); const [tab, setTab] = React.useState(is("string", props) ? props : props?.tab); let t0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { t0 = item => { setTab(item); }; $[0] = t0; } else { t0 = $[0]; } const onChange = t0; let t1; if ($[1] !== tab) { t1 = { value: tab, onChange, setTab }; $[1] = tab; $[2] = t1; } else { t1 = $[2]; } const result = t1; return result; }; export default useTabs;