create AppConfig context

This commit is contained in:
Rodrigo Antinarelli 2020-05-07 11:54:27 -03:00 committed by James A. Petts
parent 55ae4f2b6c
commit 4928e20eab

View File

@ -8,8 +8,12 @@ export const useAppContext = () => useContext(AppContext);
const AppContextProvider = ({ children }) => {
const [config, setConfig] = useState(null);
const get = ({ configKey }) => {
return config[configKey];
const get = ({ configKey = null }) => {
if (configKey) {
return config[configKey];
}
return config;
};
const add = ({ configKey, value }) => {