mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-14 10:04:03 +00:00
a41d5df60c
* no more regex replacing in interface * fix location create event * onSuccess is crine * documentation * typescript --------- Co-authored-by: brxken128 <77554505+brxken128@users.noreply.github.com>
19 lines
418 B
TypeScript
19 lines
418 B
TypeScript
import { createContext, useContext } from 'react';
|
|
|
|
interface RootContext {
|
|
rawPath: string;
|
|
}
|
|
|
|
/**
|
|
* Provides data that should be accessible to all routes but is not platform-specific.
|
|
*/
|
|
export const RootContext = createContext<RootContext | null>(null);
|
|
|
|
export const useRootContext = () => {
|
|
const ctx = useContext(RootContext);
|
|
|
|
if (!ctx) throw new Error('RootContext.Provider not found!');
|
|
|
|
return ctx;
|
|
};
|