mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-19 13:39:15 +00:00
15 lines
349 B
TypeScript
15 lines
349 B
TypeScript
|
import { createContext, useContext } from 'react';
|
||
|
|
||
|
export const RoutingContext = createContext<{
|
||
|
currentIndex: number;
|
||
|
maxIndex: number;
|
||
|
} | null>(null);
|
||
|
|
||
|
export function useRoutingContext() {
|
||
|
const ctx = useContext(RoutingContext);
|
||
|
|
||
|
if (!ctx) throw new Error('useRoutingContext must be used within a RoutingContext.Provider');
|
||
|
|
||
|
return ctx;
|
||
|
}
|