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