wip: migrate to desktop2
This commit is contained in:
@@ -1,10 +1,21 @@
|
||||
import { PropsWithChildren, createContext, useContext, useMemo } from "react";
|
||||
import {
|
||||
PropsWithChildren,
|
||||
createContext,
|
||||
useContext,
|
||||
useEffect,
|
||||
useMemo,
|
||||
} from "react";
|
||||
import { Ark } from "./ark";
|
||||
|
||||
export const ArkContext = createContext<Ark>(undefined);
|
||||
|
||||
export const ArkProvider = ({ children }: PropsWithChildren<object>) => {
|
||||
const ark = useMemo(() => new Ark(), []);
|
||||
|
||||
useEffect(() => {
|
||||
if (ark) ark.load_account();
|
||||
}, []);
|
||||
|
||||
return <ArkContext.Provider value={ark}>{children}</ArkContext.Provider>;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user