add AppContext for state management and update ResourcesView to utilize context

This commit is contained in:
2025-05-23 21:53:39 +08:00
parent 81053d56f7
commit 4038683a56
5 changed files with 53 additions and 5 deletions

View File

@@ -0,0 +1,19 @@
import {createContext, ReactNode, useContext} from "react";
export default function AppContext({
children,
}: {
children: ReactNode;
}) {
return (
<context.Provider value={new Map<string, any>()}>
{children}
</context.Provider>
);
}
const context = createContext<Map<string, any>>(new Map<string, any>());
export function useAppContext() {
return useContext(context)
}