fix: fix bugs
This commit is contained in:
parent
a2678606a2
commit
810a93628d
@ -9,7 +9,7 @@ export const useContext = (initContext?: GlobalContext) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const useContextKey = <T>(key: string, init: () => T): T => {
|
export const useContextKey = <T>(key: string, init: () => T): T => {
|
||||||
const _context = useContext();
|
const _context = useContext({});
|
||||||
if (key && init) {
|
if (key && init) {
|
||||||
_context[key] = init();
|
_context[key] = init();
|
||||||
return _context[key] as any;
|
return _context[key] as any;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user