@airplane/views
Version:
A React library for building Airplane views. Views components are optimized in style and functionality to produce internal apps that are easy to build and maintain.
25 lines (24 loc) • 576 B
JavaScript
import { useCallback } from "react";
import { useRouter } from "./useRouter.js";
const useTabsRouting = (routingKey) => {
const router = useRouter();
const routerValue = routingKey ? router.params[routingKey] : void 0;
const navigateTab = useCallback((tabValue) => {
if (routingKey) {
router.navigate({
params: {
...router.params,
[routingKey]: tabValue
}
});
}
}, [router, routingKey]);
return {
routerValue,
navigateTab
};
};
export {
useTabsRouting
};
//# sourceMappingURL=useTabsRouting.js.map