Using appContext in DataSourceWrapper and createRoutes
This commit is contained in:
1 parent
c2853f719a
commit
70ad940941
6 files changed
+31
-34
No files matched your search
@@ -4,14 +4,14 @@ import { useCallback, useState } from 'react';
|
||||
* Implements the state/methods defined in `appConfig.context`.
|
||||
*/
|
||||
export const useAppConfig = initialValue => {
|
||||
const [config, setConfig] = useState(initialValue || {});
|
||||
const [appConfig, setAppConfig] = useState(initialValue || {});
|
||||
|
||||
const setCurrentConfig = useCallback(updatedConfig => {
|
||||
setConfig(updatedConfig);
|
||||
const setCurrentAppConfig = useCallback(updatedConfig => {
|
||||
setAppConfig(updatedConfig);
|
||||
}, []);
|
||||
|
||||
return {
|
||||
config,
|
||||
setCurrentConfig,
|
||||
appConfig,
|
||||
setCurrentAppConfig,
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user