mirror of
https://github.com/johndoe6345789/low-code-react-app-b.git
synced 2026-05-02 17:44:52 +00:00
19 lines
400 B
TypeScript
19 lines
400 B
TypeScript
import { useState, useEffect } from 'react'
|
|
|
|
export function useTabNavigation(defaultTab: string) {
|
|
const [activeTab, setActiveTab] = useState(defaultTab)
|
|
|
|
useEffect(() => {
|
|
const params = new URLSearchParams(window.location.search)
|
|
const shortcut = params.get('shortcut')
|
|
if (shortcut) {
|
|
setActiveTab(shortcut)
|
|
}
|
|
}, [])
|
|
|
|
return {
|
|
activeTab,
|
|
setActiveTab,
|
|
}
|
|
}
|