mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
21 lines
432 B
TypeScript
21 lines
432 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,
|
|
}));
|
|
};
|
|
|
|
return [config, setConfig];
|
|
};
|