mirror of
https://github.com/trafficlunar/blockmatic.git
synced 2026-08-12 12:29:42 +00:00
fix: typescript errors in contexts
This commit is contained in:
parent
99bfd58c49
commit
2c852694ea
7 changed files with 55 additions and 41 deletions
|
|
@ -1,14 +1,16 @@
|
|||
import { createContext, ReactNode, useState } from "react";
|
||||
import LoadingIndicator from "@/assets/loading.svg?react";
|
||||
|
||||
interface Context {
|
||||
loading: boolean;
|
||||
setLoading: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
export const LoadingContext = createContext({
|
||||
loading: false,
|
||||
setLoading: ((value: boolean) => {}) as React.Dispatch<React.SetStateAction<boolean>>,
|
||||
});
|
||||
export const LoadingContext = createContext<Context>({} as Context);
|
||||
|
||||
export const LoadingProvider = ({ children }: Props) => {
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue