Add contexts

This commit is contained in:
Ariful Alam
2022-03-19 00:10:13 +06:00
parent 6979ee8c5c
commit cf043dab4c
2 changed files with 31 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
import { createContext, useState } from 'react';
const initialValue = true;
export const LoadingContext = createContext();
export const LoadingProvider = (props) => {
const [loading, setLoading] = useState(initialValue);
return (
<LoadingContext.Provider value={[loading, setLoading]}>
{props.children}
</LoadingContext.Provider>
);
};