Migrate from redux to context

This commit is contained in:
MD. Ariful Alam
2021-09-16 00:30:22 +06:00
parent d5c715e16e
commit 8f167cc940
21 changed files with 157 additions and 446 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>
);
}