spacedrive/interface/app/RootContext.tsx
Brendan Allan a41d5df60c
[ENG-858] Source analytics paths from router rather than regex replacement (#1053)
* 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>
2023-06-29 08:10:26 +00:00

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;
};