mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 06:28:51 +00:00
22 lines
458 B
TypeScript
22 lines
458 B
TypeScript
import Default from '../default.json';
|
|
import { atom, useRecoilState } from 'recoil';
|
|
|
|
const configState = atom({
|
|
key: 'config',
|
|
default: Default,
|
|
});
|
|
|
|
export const useConfig = (state: any = configState): any => {
|
|
const [config, _setConfig] = useRecoilState(state);
|
|
|
|
const setConfig = (key, value) => {
|
|
_setConfig((oldConfig) => ({
|
|
...oldConfig,
|
|
[key]: value,
|
|
}));
|
|
//setVal(key, value);
|
|
};
|
|
|
|
return [config, setConfig];
|
|
};
|