useToggleuseToggle+useEventRefuseSafeEffectuseEventControluseDebounceuseThrottleuseClickOutsideuseTabsuseDateuseDatesuseImageuseCaptureuseIntersectionObserver
react react-hook ironman30

useTabs

A hook aims for multi and dynamic tabs.


LINKS

鐵人賽連結


Orders



const [tabs, tabDispatch] = useTabs()

Return

name type description
tabsarrayWith [currentTab, storedTabs]
tabDispatchfunction tabDispatch(type, payload), see below

Method

tabDispatch(type, payload)
type payload description
ADD{ id, ...restData }Must include an unique id. Please aware this is for display tabs information not for panel, should not include all date in it.
REMOVEid

Remove a tab.

NAVIGATEid

To nav to specific tab, should use when onClick on tab.

RESET

Clear all tabs.

ONLYid

Clear all tabs except the given id.