create AppConfig context

This commit is contained in:
Rodrigo Antinarelli authored and James A. Petts committed 2020-05-15 14:00:05 +02:00
1 parent 55ae4f2b6c
commit 4928e20eab
1 file changed
+6 -2
@@ -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 }) => {