create AppConfig context
This commit is contained in:
parent
55ae4f2b6c
commit
4928e20eab
@ -8,8 +8,12 @@ export const useAppContext = () => useContext(AppContext);
|
|||||||
const AppContextProvider = ({ children }) => {
|
const AppContextProvider = ({ children }) => {
|
||||||
const [config, setConfig] = useState(null);
|
const [config, setConfig] = useState(null);
|
||||||
|
|
||||||
const get = ({ configKey }) => {
|
const get = ({ configKey = null }) => {
|
||||||
return config[configKey];
|
if (configKey) {
|
||||||
|
return config[configKey];
|
||||||
|
}
|
||||||
|
|
||||||
|
return config;
|
||||||
};
|
};
|
||||||
|
|
||||||
const add = ({ configKey, value }) => {
|
const add = ({ configKey, value }) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user