a tool for shared writing and social publishing
at main 18 lines 425 B view raw
1import { createContext, useContext } from "react"; 2import type { FootnoteInfo } from "./usePageFootnotes"; 3 4type FootnoteContextValue = { 5 pageID: string; 6 footnotes: FootnoteInfo[]; 7 indexMap: Record<string, number>; 8}; 9 10export const FootnoteContext = createContext<FootnoteContextValue>({ 11 pageID: "", 12 footnotes: [], 13 indexMap: {}, 14}); 15 16export function useFootnoteContext() { 17 return useContext(FootnoteContext); 18}